Is there a simple macro program so that when it is executed on sheet, it will color all the cells in every 5th row/column in grey?
Is there a simple macro program so that when it is executed on sheet, it will color all the cells in every 5th row/column in grey?
[vba]
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LastRow Step 5
.Rows(i).Interior.ColorIndex = 15
Next i
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Thanks for the formula. I can't seem to make it run. Does it matter that I have excel 2003?
do you have any data in column a?
No data, was testing it on a blank sheet. Thanks, it works.
You can also use Mod
[VBA]For i = 1 To 500
If i Mod 5 = 1 Then Rows(i).Interior.ColorIndex = 15
Next[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'