+ Reply to Thread
Results 1 to 7 of 7

Compare workbooks

  1. #1
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Pakistan
    MS-Off Ver
    Excel 2013
    Posts
    256

    Thumbs up Compare workbooks

    HI All,

    I need a code that compare1.xls with compare2.xls sheet1 column A , but without opening the compare1.xls and get the result in compare2.xls tab sheet2.

    Thanks
    farrukh
    Last edited by farrukh; 05-31-2011 at 02:53 PM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Compare workbooks

    farrukh,

    If all you're looking for is to get Compare1.xls's Sheet1 column A values put in Compare2.xls's Sheet2 column A, then in Compare2.xls, Sheet2, cell A1, put the following formula:
    ='C:\Test Folder\[Compare1.xls]Sheet1'!A1

    Then copy down.
    Note:
    Change C:\Test Folder\ to the folder path that contains Compare1.xls
    Be sure to include the ending \

    Is that what you're looking for?
    ~tigeravatar

  3. #3
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Pakistan
    MS-Off Ver
    Excel 2013
    Posts
    256

    Re: Compare workbooks

    Dear tigeravatar,

    I have two workbooks suppose compare1.xls and compare2.xls ,in both workbooks sheet1 columnA i want to check the similarity of content (name). if does not find similarity in any row column A the highlight the row with any color.

    Thanks
    Farrukh

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Compare workbooks

    farrukh,

    The following macro should accomplish what you're requesting.
    Please Login or Register  to view this content.


    To add a macro to a workbook:
    1. Save a copy of the Excel workbook you want to modify
      • Always test macros in a copy so that the original is preserved in case the modifications don't go smoothly
    2. Open the copy of the Excel workbook you want to modify
    3. Use the keyboard shortcut ALT+F11 to open the Visual Basic Editor
    4. Insert -> Module
    5. Copy/Paste the code into that area

    To run a macro in a workbook:
    1. In Excel (not the Visual Basic Editor) press the keyboard shortcut ALT+F8
    2. Double-click the desired macro (I named this one farrukhCompareMacro)

    Hope that helps,
    ~tigeravatar
    Last edited by tigeravatar; 05-31-2011 at 01:36 PM.

  5. #5
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Pakistan
    MS-Off Ver
    Excel 2013
    Posts
    256

    Re: Compare workbooks

    Thanks alot tigeravatar,
    Little change required can you please Hard coated the path to search...

    Thanks
    farrukh

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Compare workbooks

    farrukh,

    You mean instead of the macro asking you to open a file?

    ~tigeravatar

  7. #7
    Forum Contributor
    Join Date
    01-29-2011
    Location
    Pakistan
    MS-Off Ver
    Excel 2013
    Posts
    256

    Smile Re: Compare workbooks

    Dear tigeravatar

    It worked for me.

    strCompareFile = "c:\hi2.xlsx"

    Thank you so much and your kind help may God Bless you.

    Best Regards,
    Farrukh
    Last edited by farrukh; 05-31-2011 at 02:53 PM.

+ 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