Build the regular expression by transposing the master range and joining the values with |. Test the regex against each cell value in DATA and if successful execute the regex to capture the value.
Sub clean()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets(1)
Dim rngMASTER as Range, rngDATA As Range
Dim start as Single, finish as Single
start = Timer
' set ranges
Dim numLastA as Long, numLastC As Long
numLastA = ws.Range("A" & Rows.count).End(xlUp).Row
Set rngDATA = ws.Range("A2:A" & numLastA)
numLastC = ws.Range("C" & Rows.count).End(xlUp).Row
Set rngMASTER = ws.Range("C2:C" & numLastC)
'Debug.Print numLastA, numLastC
' avoid blanks in pattern
If WorksheetFunction.CountBlank(rngMASTER) > 0 Then
MsgBox "MASTER range has blank cells", vbCritical
Exit Sub
End If
' build regex pattern
Dim sPattern As String
sPattern = Join(WorksheetFunction.Transpose(rngMASTER), "|")
'Debug.Print sPattern
Dim Regex as Object
Set Regex = CreateObject("vbscript.regexp")
With Regex
.Global = True
.MultiLine = False
.IgnoreCase = True
.Pattern = "(" & sPattern & ")"
End With
' search
Dim cell as Range, match as Object
Dim count As Long: count = 0
For Each cell In rngDATA
If Regex.test(cell) Then
Set match = Regex.Execute(cell)
cell.Resize(1, 3).Copy cell.Offset(0, 5)
cell.Offset(0, 6) = match(0).submatches(0)
count = count + 1
End If
Next
finish = Timer
MsgBox numLastA - 1 & " rows scanned" & vbCr & _
count & " matches in " & Int(finish - start) & " secs"
End Sub
Edit 1; Added protection against a blank cell in MASTER which would match every row
Edit 2 ; Declared type for all variables