I am having a problem trying to create borders over a range of cells in vba. The code works correctly when I do it on one cell, but doesn’t work when placed inside of a loop.
Dim r As Integer
Dim c As Integer
With Worksheets(“Table 3”)
random stuff…
For r = 7 To Cell_Count – 1
For c = 1 To c = 20
With .Cells(r, c).Borders
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next c
Next r
I am pretty confident “Cell_Count-1” is not the problem because it works successfully with other operations in the event.