Hello Excel Gurus,
Can you please help update this so that it uses a random different color in the color index each time the value changes? The way it is working now is that it alternates between gray to white. I am trying to make it change to a different color every time the value changes all the way down a column.
This works except for the color index:
Option Explicit Sub Color_Row() Dim LastRow As Long Dim ColorFlag As Boolean Dim I As Long LastRow = Range("A" & Rows.Count).End(xlUp).Row ColorFlag = False For I = 2 To LastRow If (Cells(I, "A") <> Cells(I - 1, "A")) Then ColorFlag = Not (ColorFlag) If (ColorFlag) Then With Rows(I).Interior .ColorIndex = 15 .Pattern = xlSolid .PatternColorIndex = xlAutomatic End With End If Next I End Sub
Thank you very much.