Link to home
Start Free TrialLog in
Avatar of Alex Campbell
Alex CampbellFlag for United States of America

asked on

In Excel 2016, how can I make every other line in worksheet a different line thickness?

How to format the bordrs like this for several hundred rows?

User generated image
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Hi Alex,

Please provide a sample workbook.

First option would be to copy first tow rows range and paste special formats.
Second option would be to write VBA.
Avatar of Alex Campbell

ASKER

Attached is a sample file with before and after tabs.
I tried Conditional Formatting, but it doesn't have the line width that I wanted.
I don't how to write a macro to format the lines.
Borders.xlsx
ASKER CERTIFIED SOLUTION
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great! Thanks
Pleased to help. This may be easierto manage and adds the numbers if required

Option Explicit

Sub addLine()
    Dim Rw As Long
    Const TotalRows As Long = 500    ''/// change this number to how many rows you want
    Application.ScreenUpdating = False
    For Rw = 2 To TotalRows Step 2
        With Range(Cells(Rw, 2), Cells(Rw, 11)).Borders(xlEdgeBottom)
            Cells(Rw, 1).Value = Rw
            Cells(Rw - 1, 1).Value = Rw - 1
            .LineStyle = xlContinuous
            .ColorIndex = xlAutomatic
            .TintAndShade = 0
            .Weight = xlThick
        End With
    Next Rw
    Application.ScreenUpdating = True
End Sub

Open in new window

Thanks for that, too. I appreciate different versions for learning.