Sub Colors()
Dim cel As Range, celA As Range, rgA As Range, rgC As Range
Application.ScreenUpdating = False
Set rgA = Range("A2") 'First cell with names in column A
Set rgA = Range(rgA, Cells(Rows.Count, rgA.Column).End(xlUp))
Set rgC = Range("C2") 'First cell with names in column C
Set rgC = Range(rgC, Cells(Rows.Count, rgC.Column).End(xlUp))
For Each cel In rgC.Cells
If cel <> "" Then
Set celA = Nothing
Set celA = rgA.Find(cel, MatchCase:=False, Lookat:=xlWhole)
If Not celA Is Nothing Then cel.Interior.ColorIndex = celA.Interior.ColorIndex
End If
Next
Application.ScreenUpdating = True
End Sub
|