Hello everyone,
I would appreciate if anyone can help me with this problem -
I'd like to highlight rows with same content (in cells) in column G with the same color (could be random) -
1. if cells have the same content, the rows should have the same color
2. colors should be differnt
3. for rows that only have blank cells, rows should be left uncolored
eg
G
row1 apple
row2 pear
row3
row4 pear
row5 apple
row1 and 5 should be highlighted with a color and row 2 and 4 should be highlighted with another color;
row3 will be left blank.
========================================================
I have written something and would appreciate if you could help me debug it
Thank you very much!!!
Sub colours()
Dim I As Integer
Dim j As Integer
For I = 3 To 65536
If Cells(I, "N").Value <> "" Then For j = 1 To 65536 And j < I
If Cells(I, "N").Value = Cells(j, "N").Value Then Cells(I, "N").EntireRow.Interior.ColorIndex = j
Exit Function
Else: Next j
End If
For I = 3 To 65536
If Cells(I, "N").Value <> "" Then For j = 1 To 65536 And j < I
If Cells(I, "N").Value <> Cells(j, "N").Value Then Cells(I, "N").EntireRow.Interior.ColorIndex = I
Next I
End Sub
Bookmarks