VBA - Setting Side Borders in Varying Columns and Rows
Solution 1:
This sets vertical borders for all cells in the usedrange after row 1.
'Sets vertical borders
Dim iRange As Range
Dim iCells As Range
Set iRange = ActiveWorkbook.Worksheets("Sheet1").UsedRange.Offset(1, 1)
For Each iCells In iRange
If Not IsEmpty(iCells) Then
With iCells.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With iCells.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
End With
End If
Next iCells