Sub ColourDuplicates()
Dim r As Range, dic As Object, w
Set dic = CreateObject("Scripting.Dictionary")
dic.CompareMode = 1
Application.ScreenUpdating = False
With Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
.Resize(, 8).Interior.ColorIndex = xlNone
For Each r In .Cells
If Not IsEmpty(r.Value) Then
If Not dic.Exists(r.Value) Then
ReDim w(1 To 2)
Set w(1) = r
With Application.WorksheetFunction
w(2) = Array(.RandBetween(0, 255), .RandBetween(0, 255), .RandBetween(0, 255))
End With
dic(r.Value) = w
Else
w = dic(r.Value)
r.Resize(, 8).Interior.Color = RGB(w(2)(0), w(2)(1), w(2)(2))
If Not IsEmpty(dic(r.Value)(1)) Then dic(r.Value)(1).Resize(, 8).Interior.Color = RGB(w(2)(0), w(2)(1), w(2)(2))
w(1) = Empty
dic(r.Value) = w
End If
End If
Next r
End With
Application.ScreenUpdating = True
End Sub