Hi
Im currently using this VBA code that looks at values in column A in Sheet2 and if found it removes this value in column A in Sheet1.
Sub ifFoundReplace()
Dim i As Long, ws1 As Worksheet, ws2 As Worksheet
Set ws2 = Sheets("Sheet2")
Set ws1 = Sheets("Sheet1")
For i = 2 To ws2.Range("A" & Rows.Count).End(3).row
ws1.Columns(1).Replace ws2.Cells(i, "A") & " ", "", xlPart
ws1.Columns(1).Replace " " & ws2.Cells(i, "A"), "", xlPart
Next i
End Sub
So, on Sheet1 in column A I have:
a white
b black
d white
c orange
On Sheet2 in column A I have:
a
b
d
c
When I run the VBA, as a result I have White, Black, Orange, White, without a, b, c, d, as these values are in Sheet2.
But if I have these in Sheet1 in column A:
white a
black b
white d
orange c
the code does not work properly.
Cheers
Bookmarks