border line in every 3 cells using a excel vba

  • Thread starter Thread starter john
  • Start date Start date
J

john

sub Borders()
dim n as integer

For n = 1 To 6003/3 Step 3
With Range(Cells(n, 1), Cells(n, 2))
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeRight).LineStyle = xlContinuous
End With
Next n

End Sub

Insert this code into a new module. You just change
the "6003" number to suit yourself.
 
Back
Top