+ Reply to Thread
Results 1 to 8 of 8

Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L NON

  1. #1
    Registered User
    Join Date
    06-20-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L NON

    I hope everyone will bare with me as this is the first time I have reached out to a community like this. I have a very novice understanding of Macros and would appreciate all the help I can get in this endeavor. Please understand that this is one step in what I hope will be a HUGE learning experience for me. Please include notes in the Macro identifying what each method or line of code does, as I will need to ammend this in the near future. This is a growing project...

    I need a Macro that will do the following:

    Compare Column "A" from Sheet "Master" with Column "A" from "Report"
    Any item where Column "A" Report DOES NOT = Column "A" Master, Copy the entire row into the 1st empty line in "Master" Sheet (making the "Master" up-to-date)
    Any items that appear in Column "A" Master and NOT in Column "A" Report, Highlight RED. (indicating this item no longer exists).

    For all intents and purposes, the titles of the sheets can actually be programmed as "Master" and "Report" (this will make it easier for me to adapt it to the sheets I actually have).

    I can attach a file if ABSOLUTELY necessary (but it may take some time to scrub out any/all proprietary information).

    Thanks in advance for any help provided.

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L

    The code is in two parts.
    Part 1: I searched column A from Report for every item in column A in Master.
    If it was not found, then that item in column A in Master is red.
    Part 2: I searched column A from Master for every item in column A in Report.
    If it was not found, then that row from Report was added to the bottom of Master.

    Please Login or Register  to view this content.
    Last edited by StevenM; 06-30-2012 at 09:42 AM. Reason: Removed one line.

  3. #3
    Registered User
    Join Date
    06-20-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L

    SteveM,

    Thank you so very much for all your help. However, I forgot to mention one thing (as I mentioned earlier I'm kinda new at VBA), the first 5 rows of the "Report" worksheet are system generated header text (useful only if you were to use that report alone). Is there a way to start searching the "Report" worksheet at row 6?

    If so, would you mind providing this ammendment? (simply insert the ammendment in your previous VBA code in BOLD)

    Thanks in advance and for all your help thus far. Your AWESOME.[/FONT]

  4. #4
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L

    To avoid headers change:

    Please Login or Register  to view this content.
    For the Worksheet Report, that would be the line following:

    Please Login or Register  to view this content.
    So you can change 1 to 6, or whatever. This number should be the first row of data.

    Now the search is the whole column A. As long as the items won't match anything in the headers, that shouldn't be a problem. But if it is, we can modify Range("A:A") in the line:

    Please Login or Register  to view this content.
    Also, I'll note that I deleted a line after I had posted my code. So that if you read my message before I made the deletion, you should re-copy the code as it is now.

  5. #5
    Registered User
    Join Date
    06-20-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L

    SteveM,

    Once again you are AWESOME. Thanks for all the help. Worked SUPER!

  6. #6
    Registered User
    Join Date
    06-20-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L

    SteveM,

    For some reason the non-matches from "Report" keep appearing at approx. cell A2000 (tried on several reports some @ A1500, some @ A2000). Is there a reason for this? Does the Macro think A2000 is the last cell or row? From what I can tell the Macro judges the last row based in text in the cell... Or am I missing something?

  7. #7
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L

    Is there anyway you can upload a worksheet where you experience a problem? If not, what do you mean by "keep appearing"?

    When I first posted the code, I had the following line in twice:

    Please Login or Register  to view this content.
    But I took it out when I edited the code (there should be only one line now). If that second line is still in, then it could cause some funny results. (It was a copy and paste mistake.)

    If I had a worksheet which exhibited the problem, I could step through the code and find the problem. But without a worksheet, there is not much I can do.

  8. #8
    Registered User
    Join Date
    06-20-2012
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Compare Col A across 2 Sheets in different Workbooks, Copy Matches to MASTER list, H/L

    SteveM,

    Sorry for the late response, w/ the 4th of July and new projects emerging I've been swamped. Anyway, enough of my babbling... I figured out that some of the code I added was messing things up. Yours was excellent! Once again, thanks so very much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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