+ Reply to Thread
Results 1 to 10 of 10

search range in workbook 2 for matching value from column in workbook 1 then copy row

  1. #1
    Registered User
    Join Date
    12-31-2015
    Location
    in the USA
    MS-Off Ver
    2007
    Posts
    19

    search range in workbook 2 for matching value from column in workbook 1 then copy row

    i have 2 workbooks; we'll call them 1 and 2.

    workbook 1, column A, has usernames: each one unique, all alpha numeric combinations.

    workbook 2 has several columns (range) which contain SOME (not all) of the values from workbook 1, column A.

    I would like to search the range in workbook 2 for matching values from column A workbook 1.

    when a match is found in workbook 2, then copy that entire row from workbook 2 where the match occurred to another worksheet or workbook (either is fine)

    can someone please help me with an elegant way to perform this?

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: search range in workbook 2 for matching value from column in workbook 1 then copy row

    The destination: A single sheet for all matches, or a different sheet for each match?

  3. #3
    Registered User
    Join Date
    12-31-2015
    Location
    in the USA
    MS-Off Ver
    2007
    Posts
    19
    Quote Originally Posted by leelnich View Post
    The destination: A single sheet for all matches, or a different sheet for each match?
    A Single sheet.thanks!

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: search range in workbook 2 for matching value from column in workbook 1 then copy row

    Try this:
    Please Login or Register  to view this content.
    Obviously, you'll need to change the names and Ranges to suit.

    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee
    Last edited by leelnich; 05-23-2017 at 01:59 PM.

  5. #5
    Registered User
    Join Date
    12-31-2015
    Location
    in the USA
    MS-Off Ver
    2007
    Posts
    19

    Re: search range in workbook 2 for matching value from column in workbook 1 then copy row

    i get a 'run time error 9' subscript out of range on this line;

    Set WS3 = Workbooks("workbook3").Worksheets("Sheet1")

    i believe my ranges and names are correct.

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: search range in workbook 2 for matching value from column in workbook 1 then copy row

    Can you paste your updated code, I'll check syntax. That error means it can't find the workbook or worksheet.
    ps Workbook names must include file extension ex. "Workbook1.xlsx"
    Last edited by leelnich; 05-23-2017 at 02:40 PM.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb

    Hi !

    Around ten codelines just using an easy advanced filter …

  8. #8
    Registered User
    Join Date
    12-31-2015
    Location
    in the USA
    MS-Off Ver
    2007
    Posts
    19

    Re: search range in workbook 2 for matching value from column in workbook 1 then copy row

    Hi got it working thank you. The way it is currently, you have to create 'workbook3' and make sure it is OPEN....or it breaks. THANK YOU for your help!!


  9. #9
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: search range in workbook 2 for matching value from column in workbook 1 then copy row

    Happy to help. If you're satisfied with this solution, please go to your original post, select Thread Tools, and mark this thread as SOLVED. Thanks-Lee

    Please click the Add Reputation star below any helpful posts, and if you have your answer, mark your thread as SOLVED (Thread Tools up top). Thanks!-Lee

  10. #10
    Registered User
    Join Date
    12-31-2015
    Location
    in the USA
    MS-Off Ver
    2007
    Posts
    19

    Re: search range in workbook 2 for matching value from column in workbook 1 then copy row

    done. -best

+ 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. VBA search if values from one range in another workbook and copy different column **urgent
    By Greg_Tilearcio in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-08-2015, 01:12 PM
  2. Search cell values from range in another workbook and copy found row to a 3rd workbook.
    By SierraKilo78 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-09-2014, 01:09 PM
  3. [SOLVED] Search cell value in another workbook and copy range from current to other workbook
    By SierraKilo78 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2014, 05:20 PM
  4. Search multiple workbook headers and copy column entries to another workbook
    By R3n3gad3-XtC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2012, 12:47 AM
  5. [SOLVED] Search workbook for matching detail and copy/paste the row/column content.
    By GB.RTMC in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-28-2012, 09:55 AM
  6. VBA Search workbook for user value, copy/paste entire row to last sheet for matching
    By jasonkrispy21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2012, 03:42 PM
  7. insert data from child workbook to master workbook by search matching records
    By jjgal767 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-21-2011, 05: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