Hi guys, I am trying to use a for loop to do some formatting work. however, the for loop seems to stop everytime I put in the line to change cell color.
I have tested it with a simple loop, pls see the code below. Could anyone advise me why this happens?
Thanks
Sub test()
Dim i As Integer
For i = 1 To 20
Range(Cells(1, 1).Offset(0, 0), Cells(1, 1).Offset(i, 0)).Select
Selection.Interior.ColorIndex = i
Next i
End Sub
Bookmarks