Hi,
I have the below macro that adds fill color grey to my even rows and white to my odd rows.
How can I make it so this macro skips the "cells" that already have a specific color?
For example:
If cell "E4" has color RGB(255, 192, 0) which is the regular orange, then I want that cell to stay as that color and not change to grey like the rest of that row and all other even rows.
Also, I'd need more than just orange.
Yellow = RGB(255, 255, 0)
Light Green = RGB(226, 239, 218)
Light Blue = RGB(221, 235, 247)
Light Orange = RGB(252, 228, 214)
Light Yellow = RGB(255, 242, 204)
Thank you!
Before:
After:
Sub Color_Rows()
Dim i, count As Long
Dim e As Long
i = 2
count = ActiveSheet.Cells(Rows.count, "A").End(xlUp).Row
e = ActiveSheet.Cells(1, Columns.count).End(xlToLeft).Column
Do While i <= count
Range(Cells(i, 1), Cells(i, e)).Interior.Color = RGB(217, 217, 217)
i = i + 1
If i > count Then
Exit Do
End If
Range(Cells(i, 1), Cells(i, e)).Interior.Color = RGB(255, 255, 255)
i = i + 1
Loop
End Sub
I have the below macro that adds fill color grey to my even rows and white to my odd rows.
How can I make it so this macro skips the "cells" that already have a specific color?
For example:
If cell "E4" has color RGB(255, 192, 0) which is the regular orange, then I want that cell to stay as that color and not change to grey like the rest of that row and all other even rows.
Also, I'd need more than just orange.
Yellow = RGB(255, 255, 0)
Light Green = RGB(226, 239, 218)
Light Blue = RGB(221, 235, 247)
Light Orange = RGB(252, 228, 214)
Light Yellow = RGB(255, 242, 204)
Thank you!
Before:
After:
Sub Color_Rows()
Dim i, count As Long
Dim e As Long
i = 2
count = ActiveSheet.Cells(Rows.count, "A").End(xlUp).Row
e = ActiveSheet.Cells(1, Columns.count).End(xlToLeft).Column
Do While i <= count
Range(Cells(i, 1), Cells(i, e)).Interior.Color = RGB(217, 217, 217)
i = i + 1
If i > count Then
Exit Do
End If
Range(Cells(i, 1), Cells(i, e)).Interior.Color = RGB(255, 255, 255)
i = i + 1
Loop
End Sub