+ Reply to Thread
Results 1 to 6 of 6

highlight unique values between two workbooks

  1. #1
    Registered User
    Join Date
    01-17-2017
    Location
    NEW JERSEY
    MS-Off Ver
    10.0
    Posts
    28

    highlight unique values between two workbooks

    Hi,

    i have code that will highlight rows in workbook 1 if the values in column A of workbook 1 match the values in column A of workbook 2. Now i need to do the opposite and highlight any rows that have a unique value in column A of workbook 1 that is not found in column A of workbook 2.I need to do this using VBA. Below is the code i have which works for highlighting matching values. any help is greatly appreciated.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,959

    Re: highlight unique values between two workbooks

    You actually have code that will highlight column I if the values in A match but the values in K do not.

    Not the best method, but that is what it is doing.

    So, perhaps, just change the <> in this line to =

    Please Login or Register  to view this content.
    If that isn't what you want, post back with a better description.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    01-17-2017
    Location
    NEW JERSEY
    MS-Off Ver
    10.0
    Posts
    28

    Re: highlight unique values between two workbooks

    Sorry i wasn't clear. The code i posted works for what i need it to do. In that code i want to highlight column I if the A = A and I does not = I. What i don't know how to do is to highlight the entire row in workbook 1 if the value in column A in workbook 1 does not match any of the values in column A of workbook 2. so something like
    Please Login or Register  to view this content.
    Except that this doesn't work. It highlights every single row since there is obviously going to be a value that doesn't match since it is searching the entire column.

    From searching around it seems that i will need to create a custom function but i don't know how to do that properly.

    Hope this clarifies.

  4. #4
    Registered User
    Join Date
    01-17-2017
    Location
    NEW JERSEY
    MS-Off Ver
    10.0
    Posts
    28

    Re: highlight unique values between two workbooks

    Also, you mentioned that i am not using the best method. I am new to VBA so if you don't mind showing me a better method i would really appreciate it.

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,959

    Re: highlight unique values between two workbooks

    Sure - let's look at just your nested loops where you do the check and coloring.

    First, to make it so that a value not found results in a highlighted row, using your nested loop for the check:

    Please Login or Register  to view this content.
    Now, to make it so that we don't use the interior nested loops for the check - this code uses the worksheet function Match, which will return the row number if it finds a value in the column, and an error if it is not found:

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 03-10-2017 at 01:28 PM.

  6. #6
    Registered User
    Join Date
    01-17-2017
    Location
    NEW JERSEY
    MS-Off Ver
    10.0
    Posts
    28

    Re: highlight unique values between two workbooks

    Awesome! used the Match function and worked like a charm!

    Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need to compare two columns and highlight unique values.
    By @jerry in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-06-2015, 03:20 AM
  2. Compare and identify unique values from different workbooks
    By la_chua29 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2015, 01:44 AM
  3. Compare Columns & Highlight Unique Values
    By TheExcelNewbie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-21-2015, 10:06 AM
  4. [SOLVED] Compare table on 2 separate spreadsheets and highlight unique values
    By lashellr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-14-2014, 01:50 PM
  5. Replies: 12
    Last Post: 04-11-2014, 07:18 PM
  6. Create Workbooks based on Unique Values from a Column
    By aravindhan_31 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-10-2012, 04:25 AM
  7. Macro to find Unique Values and Highlight them?
    By donnydorko in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-06-2010, 05:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1