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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,224,829
Messages
6,181,218
Members
453,024
Latest member
Wingit77

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