KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've come up with the following to alternate row colors within a specified range: Sub AlternateRowColors() Dim lastRow as Long lastRow = Range("A1").End(xlDown).Row For Each Cell In Range("A1:A" & lastRow) ''change range accordingly If Cell.Row Mod 2 = 1 Then ''highlights row 2,4,6 etc|= 0 highlights 1,3,5 Cell.Interior.ColorIndex = 15 ''color to preference Else Cell.Interior.ColorIndex = xlNone ''color to preference or remove End If Next Cell End Sub That works, but is there a simpler method? The following lines of code may be removed if your data contains no pre-exisiting colors: Else Cell.Interior.ColorIndex = xlNone
Tags (comma-separated)
Save Edits
Cancel