I'm trying to make a spreadsheet so that everytime I add a new row, the background is a different colour. I want two colours that alternate as you go down the rows so that it is easier to read. Is there a way to do this automatically when I type in text? I have the following code, which works, but there's going to be a lot of 'if' statements if I try to continue this for my whole sheet!!
Obviously the "k3 = odd" part refers to a cell that states whether the row number is odd or even.
Is there any clever way of doing this?
Thanks
hwc535
Code:
If Range("K3") = "odd" Then
Range("a3:e3").Select
With Selection.Interior
.ColorIndex = 35
.Pattern = x1Solid
.PatternColorIndex = x1Automatic
End With
ElseIf Range("K3") = "even" Then
Range("a3:e3").Select
With Selection.Interior
.ColorIndex = 36
.Pattern = x1Solid
.PatternColorIndex = x1Automatic
End With
End If
Obviously the "k3 = odd" part refers to a cell that states whether the row number is odd or even.
Is there any clever way of doing this?
Thanks
hwc535