+ Reply to Thread
Results 1 to 3 of 3

Compare two simple workbooks then copy and paste

  1. #1
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Compare two simple workbooks then copy and paste

    I have two seperate simple workbooks (Workbook1 and Workbook2). Both workbooks have two columns of data (column A & B). In both workbooks, column A is a list of ID numbers. In Workbook1, Column B is the UserName associated with the ID number in column A. In Workbook2, column B is simply a Usage value irrelevent to my question. First, I would like the macro to insert a new blank column between column A & B in Workbook2 (I would then have three columns, column A = ID, column B is now blank, column C = Usage). Then I would like to compare each of the numbers from column A in Workbook1 with the each of the numbers in column A in Workbook2. If there is a match, copy the corresponding UserName from column B in Workbook1 and insert it next to (in new column B) the matching ID in Workbook2. See attached Workbook1 and Workbook2.
    Attached Files Attached Files
    Last edited by rkjudy; 12-23-2010 at 10:53 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Compare two simple workbooks then copy and paste

    Try this macro.

    Please Login or Register  to view this content.
    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007.
    Martin

  3. #3
    Forum Contributor rkjudy's Avatar
    Join Date
    03-31-2009
    Location
    Longview, TX
    MS-Off Ver
    MS Office 2010
    Posts
    239

    Re: Compare two simple workbooks then copy and paste

    Works Great !! Thanks.

+ 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