+ Reply to Thread
Results 1 to 14 of 14

Compare Two workbooks

  1. #1
    Forum Contributor
    Join Date
    10-21-2012
    Location
    Ind
    MS-Off Ver
    Excel 2010
    Posts
    110

    Compare Two workbooks

    Hey guys!

    I have this task which is driving me crazy!

    Now my task looks like this: I have to compare two excel workbooks. One contains old data, and the other new data. Now I need to compare every worksheet from the file with new data. Sometimes there are lot of sheets & sometimes few sheets. If there is mismatch in data then code should bring that data into new workbook.


    So far I have found below code. But it’s really not working Please advise.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Compare Two workbooks

    Hi Akulka,

    What does your data look like and is it the same field by field and are there key fields? and,and ....
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    10-21-2012
    Location
    Ind
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Compare Two workbooks

    Data differ each times. Sometimes I got A:F column data. Sometimes its hugh. Another thing I would like to tell you that both file have same filed & column. Volumes differs.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Compare Two workbooks

    Can you post a couple of sample spreadsheets?

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  5. #5
    Forum Contributor
    Join Date
    10-21-2012
    Location
    Ind
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Compare Two workbooks

    I have attached 3 workbooks where I explained my issue. The OUTPUT file gives you idea what I am trying to do. It is not mandatory that I need output what I mentioned over there. You can suggest me more good idea. At the end of the day I need to know where is data getting changed in both file so that I can pass in data quality.
    Attached Files Attached Files

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Compare Two workbooks

    Hi Akulka,

    Must the routine search for these tables or are they always in the same place?

    This works with your sample data:

    Please Login or Register  to view this content.
    Last edited by xladept; 02-15-2014 at 05:51 PM.

  7. #7
    Forum Contributor
    Join Date
    10-21-2012
    Location
    Ind
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Compare Two workbooks

    This the main challenge because for each report table places are changed.

    I am getting error on Set wt = Workbooks(T & ".xlsx")
    Last edited by akulka58; 02-15-2014 at 06:51 PM.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Compare Two workbooks

    Hi Akulka,

    Do you need instructions on how to run it?

  9. #9
    Forum Contributor
    Join Date
    10-21-2012
    Location
    Ind
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Compare Two workbooks

    Plz help me.

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Compare Two workbooks

    Hi Akulka,

    You need the set up that you sent me i.e.
    Today's Book, Yesterday's Book and a Book named Output


    Copy the code to the clipboard
    In the Book named Output
    Press ALT + F11 to open the Visual Basic Editor.
    Select Module from the Insert menu
    Type "Option Explicit" then paste the code into the white space on the right.

    With the cursor between Sub and End Sub press F5 OR

    Press ALT + Q to close the code window.
    Press ALT + F8 then double click on the macroname (Akulka)

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Compare Two workbooks

    Oh - I forgot to tell you to save the Workbook as Macro-Enabled - sorry

  12. #12
    Forum Contributor
    Join Date
    10-21-2012
    Location
    Ind
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Compare Two workbooks

    Th code is throwing same error. Another thing is can we use Application.GetOpenFilename command because I do have 60 different reports to compare & their worksheet names not always DATA1, DATA2, DATA3.

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Compare Two workbooks

    I am getting error on Set wt = Workbooks(T & ".xlsx")
    If it's a subscript error then you don't have a book named 2152014.xlsx??

    I'll look into the GetOpenFilename option - but, it won't be today.

    Maybe another forum contributor can help you?

    And, thanks for the rep!
    Last edited by xladept; 02-16-2014 at 01:39 PM.

  14. #14
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Compare Two workbooks

    Hi Akulka,

    My plans fell through - try this and let me know of the next issue

    Please Login or Register  to view this content.

+ 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. Compare two workbooks
    By mattwellings in forum Excel General
    Replies: 0
    Last Post: 07-14-2011, 10:09 AM
  2. Compare workbooks
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-31-2011, 02:35 PM
  3. Compare two Workbooks
    By MBCMDR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2009, 09:11 AM
  4. Compare Workbooks VBA - Please Help
    By bkeller83 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2009, 01:19 AM
  5. COMPARE 2 WORKBOOKS
    By dgr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2005, 06:10 AM

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