VBA Highlight Cells that don't match master list in a column

TransRlucent

New Member
Joined
Dec 12, 2018
Messages
2
Hello eveyone! I'm having some trouble taking apart this code I found. I'm looking to error check a group of cells and I'd like to highlight the ones that don't match a Master list.

For some reason I can't get this to highlight the cells that DON'T match the list.

Please help me through this, I'd be very grateful!

Code:
Dim myRange, v, f, a
    Set myRange = Range("P12:P200")
    For Each v In Workbooks("Formula_Weighup Audit Auto-Fill Final").Worksheets("Active Master List").Range("J2:J1054")
        Set f = myRange.Find(what:=v, lookat:=xlPart)
        If f Is Nothing Then
            a = f.Address
            Do
                f.Interior.ColorIndex = 5
                Set f = myRange.FindNext
            Loop While f.Address <> a
        End If
    Next


MsgBox "Error: R&D #(s) do not exist" & vbNewLine & "(see highlighted items)"
            Exit Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try this
Code:
    Dim myRange1 As Range, myRange2 As Range, v, f
    Set myRange1 = Range("P12:P200")
    Set myRange2 = Workbooks("Formula_Weighup Audit Auto-Fill Final").Worksheets("Active Master List").Range("J2:J1054")

    For Each v In myRange2
        Set f = myRange1.Find(what:=v, lookat:=xlPart)
        If f Is Nothing Then v.Interior.ColorIndex = 5
        Set f = Nothing
    Next

If not getting desired result, please detail content of each list and explain what is deemed a match
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,583
Messages
6,114,495
Members
448,575
Latest member
hycrow

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top