I have 2 workbooks stored on networked Drives.
WorkBook A is the main file, WorkBook B is the reference file.
WorkBook A has a list of part numbers in column B (some of which are repeated, and they are not in certain order)
WorkBook B has a list of part numbers on constraint in column C (the number of rows will fluctuate)
I would like the user to be able to open both WorkBooks and have the Macro highlight the matches on WorkBook A.
Found this but it did not work:
Any help would be appreciated.Sub shauk() Dim wkb1 As Workbook, wkb2 As Workbook, rang1 As Range, rang2 As Range Dim i As Long, j As Long, k As Long, l As Long, m As Long, n As Long Set wkb1 = Workbooks("WorkBook A") Set wkb2 = Workbooks("WorkBook B") wkb1.Activate Set rang1 = wkb1.Sheets("Parts").Range(Range("G4"), Range("G16").End(xlDown)) wkb2.Activate Set rang2 = wkb2.Sheets("Xerox").Range(Range("C5"), Range("C34").End(xlDown)) i = rang1.Rows.Count j = rang2.Rows.Count m = 1 n = 1 With wkb1 For k = n To i With wkb2 For l = m To j If rang1.Cells(k, 1) <> rang2.Cells(l, 1) Then Exit For Else If rang1.Cells(k, 1) = rang2.Cells(l, 1) Then rang1.Cells(k, 1).Interior.Color = RGB(0, 255, 0) End If End If Next End With Next End With wkb1.Activate End Sub
It would be good if you attach a sample workbook so we can understand the data.
Also, the matches should be highlighted in just 1 column or the entire row should be highlighted?
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks