hi
i have 2 columns
A:A contains a list of short names eg "rob", "chris"
B:B contains a list of long names eg "christopher jones", "robert smith"
i need a macro to check that a short name (from col A) appears in one or more of the long names (col B) if it does appear then put a flag in col C
i've used LIKE and this code so far - where am i going wrong?
quizzed
faxof
i have 2 columns
A:A contains a list of short names eg "rob", "chris"
B:B contains a list of long names eg "christopher jones", "robert smith"
i need a macro to check that a short name (from col A) appears in one or more of the long names (col B) if it does appear then put a flag in col C
i've used LIKE and this code so far - where am i going wrong?
Code:
Sub searchNames()
Dim searchString As String
Dim lastA As Integer
Dim lastB As Integer
lastA = Range("a65536").End(xlUp).Row
lastB = Range("b65536").End(xlUp).Row
For i = 2 To lastA
searchString = Cells(i, 1)
For x = 1 To lastB
If searchString Like Cells(x, 2).Value Then
Cells(i, 3).Value = "MATCH"
End If
Next x
If Cells(i, 3).Value <> "MATCH" Then Cells(i, 3).Value = "clear"
Next i
End Sub
quizzed
faxof