I am trying to automate border formatting via VBA code for a select range.
The rows of the range will stay between 4 and 27. For the columns it's 4 at a time that it will move to the right.
However I am not sure how I can easily move the columns to run it several times. I used the Macro recording to get the exact formula.
When I did it multiple columns, I got it in chunks, 2nd VBA code below.
The rows of the range will stay between 4 and 27. For the columns it's 4 at a time that it will move to the right.
However I am not sure how I can easily move the columns to run it several times. I used the Macro recording to get the exact formula.
When I did it multiple columns, I got it in chunks, 2nd VBA code below.
VBA Code:
Sub Border_Thick()
Range("AG4:AJ27").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
End Sub
VBA Code:
Range( _
"BI4:BL27,BM4:BP27,BQ4:BT27,BU4:BX27,BY4:CB27,CC4:CF27,CG4:CJ27,CK4:CN27,CO4:CR27,CS4:CV27,CW4:CZ27" _
).Select