+ Reply to Thread
Results 1 to 6 of 6

Macro that compares two worksheets by ID and outputs changes

  1. #1
    Registered User
    Join Date
    09-21-2010
    Location
    Geneva, Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Macro that compares two worksheets by ID and outputs changes

    Hey there,

    I'm not 100% sure this is easy to do in Excel, but I know it's possible in MySQL.

    Basically, I'm looking for a macro that can loop through two different workbooks (it's OK if I have to put the worksheet names to compare in the code manually) comparing line for line, not by line number, but by a unique ID that will be living in column A.

    Ideally, afterwards this would output which lines deviate, and which column in particular does so.

    If need be, this can also be put together into one workbook, and I could copy all the data into two worksheets and we could keep it all within one workbook.

    The reason for this is basically comparing data to historic data and seeing if there are differences.

    If my description isn't clear please let me know - I'll give whatever details I can.

    Best,
    Andy

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Macro that compares two worksheets by ID and outputs changes

    You could try this...

    Please Login or Register  to view this content.
    Last edited by Andrew-R; 10-01-2010 at 05:29 AM.

  3. #3
    Registered User
    Join Date
    09-21-2010
    Location
    Geneva, Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Macro that compares two worksheets by ID and outputs changes

    Andrew - Awesome. Unfortunately it looks like im buried until the end of the day, but I'll play with it over the weekend and hopefully by Monday I'll be able to tell you how awesome this works.

    Best,
    Andy

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Macro that compares two worksheets by ID and outputs changes

    OK. It's untested and coded off the top of my head, so let me know if you find any bugs and I'll sort them out.

  5. #5
    Registered User
    Join Date
    09-21-2010
    Location
    Geneva, Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Macro that compares two worksheets by ID and outputs changes

    Hey Andrew (or whoever else feels like helping),

    After wondering like an idiot why I was getting "run time error 9 subscript out of range", I realized I had to have the two to be compared files open.

    I succesfully ran the macro, and I intentionally planted differences in the two files. Unfortunately there was no output on the macro. Any idea why?

    Thanks a lot in advance!

    Best,
    Andy

  6. #6
    Registered User
    Join Date
    09-21-2010
    Location
    Geneva, Switzerland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: Macro that compares two worksheets by ID and outputs changes

    Can anyone else help with this?

    Best,
    Andy

+ 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