Marking found records in Workbook A from Target List in WorkbookB
Hi JP
Run this code from Workbook B, this is important. It assumes you have
Book A open at the time you run it. Also does not clean up the file
just looks at the filled range in WorkbookB col A and finds matches
from this point.
Take care
Marcus
Sub CheckMatches()
Dim RngCell As Range
Dim IsMatch() As Variant
Dim res As Variant
Dim lw As Long
Dim lr As Long
Dim X As Range
Dim wb As Workbook
Dim ws As Worksheet
lr = Range("A" & Rows.Count).End(xlUp).Row
Set wb = Workbooks("Book1.xls")
Set ws = wb.Sheets("Sheet1")
IsMatch() = Range("A2:A" & lr).Value
lw = ws.Range("A" & Rows.Count).End(xlUp).Row
Set X = ws.Range("A2:A" & lw)
For Each RngCell In X
res = Application.Match(RngCell.Value, IsMatch, 0)
If IsError(res) Then
'No Match
Else ' Match
RngCell.Interior.Color = vbYellow
End If
Next RngCell
End Sub
|