Try this macro (this will color rows 2,4,6,8 etc red)
Sub test()
Dim j As Integer, k As Integer
j = Range("a1").End(xlDown).Row
'j is the last row
For k = 1 To j
If k Mod 2 = 0 Then
Cells(k, "a").EntireRow.Interior.ColorIndex = 3
End If
Next k
End Sub
if you want rows 1,3,5,7 etc to be colored change the following line in the above macro If k Mod 2 = 0 Then into If k Mod 2 = 1 Then |
Quote
Sub test()
Dim j As Integer, k As Integer
j = Range("a1").End(xlDown).Row
'j is the last row
For k = 1 To j
If Rows(k).Hidden = False Then
Cells(k, "a").EntireRow.Interior.ColorIndex = 3
End If
Next k
End Sub
|