Too hard without seeing your workbook.
Completely untested.
Sub DoColors_v2()
Dim dic As Object, a, i As Long, r As Range, rng As Range, myPtn As String
Application.StatusBar = "Coloring..."
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
dic.CompareMode = 1
a = Worksheets("Colors").Range("A2:C257").Value
For i = 1 To UBound(a, 1)
If Trim(a(i, 1)) <> "" Then dic(Trim(a(i, 1))) = i
Set a(i, 3) = Nothing
Next
Set rng = Worksheets("Setup 1").Range("A3:AA2000")
myPtn = Join(dic.keys, Chr(2))
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "([()^|\\\[\]{}+*?.-])"
myPtn = Replace(.Replace(myPtn, "\$1"), Chr(2), "|")
.Pattern = "^(" & myPtn & ")$"
For Each r In rng
If .test(r.Value) Then
If a(dic(r.Value), 3) Is Nothing Then
Set a(dic(r.Value), 3) = r
Else
Set a(dic(r.Value), 3) = Union(a(dic(r.Value), 3), r)
End If
End If
Next
End With
For i = 1 To UBound(a, 1)
If Not a(i, 3) Is Nothing Then a(i, 3).Interior.Color = a(i, 2)
Next
Application.ScreenUpdating = True
Application.StatusBar = ""
End Sub
Bookmarks