+ Reply to Thread
Results 1 to 5 of 5

Comparing two excel files macro

  1. #1
    Registered User
    Join Date
    11-02-2010
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    2

    Comparing two excel files macro

    Hey guys!

    I have this task which is driving me crazy! I tried to ask Google and search through different forums, but I couldn't find much which could help me.

    Now my task looks like this:
    I have to compare two alike excel workbooks (each containing seven worksheets), with same formatting but slightly different content. One contains old data, and the other new data.
    Now I need to compare every worksheet from the file with new data, with the one from workbook with old data. I just have to compare column B (starting with row 14) which is filled with strings. If the old sheet holds some elements which the new one doesn’t then the complete row from the old sheet should be added at the first empty row at the worksheet from the file with new data. And maybe even a little highlighted, but I guess that’s then not a big of a problem

    And that’s it. I'm stuck after opening the two different files.

  2. #2
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    re: Comparing two excel files macro

    Welcome to the forum!

    Here's a macro that might meet your needs. The old and file file names need to be updated to match the ones that you are using. I have highlighted the new rows in yellow.
    Please Login or Register  to view this content.
    Bob
    Click my star if my answer helped you. Mark the thread as [SOLVED] if it has been.

  3. #3
    Registered User
    Join Date
    11-02-2010
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    2

    re: Comparing two excel files macro

    Wow, thanks pal!
    This really helped! The code works perfect now.

    Thanks again!

  4. #4
    Registered User
    Join Date
    12-03-2010
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    1

    re: Comparing two excel files macro

    hI,

    i have the same situation here in my job, but I don't know a lot about macros, so I hope you can help me.
    I updated the file's names and tried to run the macro, but it stops in this line:

    Set oldBook = Workbooks.Open(oldFile)

    what should I do in this case?
    Do I need to change the file nema, or should I open the files to run this macro?

    What am I doing wrong, please?

    Thanks ! ! !

  5. #5
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    re: Comparing two excel files macro

    I would suggest that you start your own thread and more fully state the problem that you are having. You will notice in my original reply that you do need to set the name of the files to the one's you are using. Tirion, if if are though with this thread, please close it. See forum rules #9 for how to do this.

+ 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