I have two sheets where Sheet 1 has three vendor number in column A and Sheet 2 has a list of account names in column B.
I would like to search in Sheet 1 column A all cells where the value contains the cell value in Sheet 2 column C. For example, if the cells from C2:C5 contain one of the value between A2:A4, Sheet 2 cells from E2:E5 will show "Yes" else showing nothing.
Below are my codes, but I keep getting an error message:
"Invalid Next control variable reference".
Set sh1 = Worksheets("Vendor")
Set sh2 = Worksheets("Invoice")
Set r1 = sh1.Range("A2:A4")
Set sh1 = Worksheets("Vendor")
Set sh2 = Worksheets("Invoice")
Set r1 = sh1.Range("A2:A4")
Set r2 = sh2.Range("E2:E5")
For Each vendorCell In r2
If cell = vendorCell Then
cell = "Yes"
Else
cell = "out of range"
Exit For
End If
Next cell