+ Reply to Thread
Results 1 to 13 of 13

Extract selective data from multiple worksheets into a new workbook

  1. #1
    Registered User
    Join Date
    12-02-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    7

    Extract selective data from multiple worksheets into a new workbook

    Using Excel 2010.

    Hi forum. I've been working on some macros lately but I'm definitely no VBA expert. So I'd like to seek some help here.

    I have multiple workbooks in the same folder with 2 worksheets in each:

    - Summary

    A B C D E
    1 ID Dealer Location Course Name Course Type
    2 CIV001 Civic Manila Warranty GEN
    3 CIV002 Civic Manila Basic Mechanics TECH
    4 CIV003 Civic Manila Basic Computer IT
    5 CIV004 Civic Manila Advanced Mechanics TECH
    6 CIV005 Civic Manila Warranty GEN

    - Participants Name

    A B
    1 ID Name
    2 CIV001 Tom
    3 CIV001 Henry
    4 CIV002 Carol
    5 CIV002 Michelle
    6 CIV002 Tom
    7 CIV003 Alan
    8 CIV003 Ben
    9 CIV004 Charlie
    10 CIV004 Peggy
    11 CIV004 Alan
    12 CIV005 Henry
    13 CIV005 Michelle
    14 CIV005 Ben


    Let's say, I wanna create a macro that will extract IDs CIV002 to CIV004 from both Summary and Participants Name from all the workbooks into a new workbook with 2 similar worksheets. How do I come about to do it?

    Thanks a lot!

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Extract selective data from multiple worksheets into a new workbook

    Hello and welcome.

    Try this macro. This is assuming all your IDs are beginning with "CIV" and has 3 digits number. It will prompt for a starting number, an ending number and for the workbooks. It is also assuming all your worksheets in the workbooks are named the same.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-02-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Extract selective data from multiple worksheets into a new workbook

    Hey millz, thanks for the help right there!

    Perhaps I didn't specifically mention some issues, so I need more assistance.

    • The first 3 letters in the IDs are derived from the dealers, and I have around 7 dealers. So the letters will vary;

    • The table I posted for the Summary worksheet is just part of what I have. It goes all the way to Column U;

    • And I ran your VBA code. It did copy accordingly from the Participants' Name worksheet, but not the data from the Summary worksheet.

    In short, I wanna copy the selective data (from Column A to U) in the Summary worksheet, and the participants' names in accordance to the IDs copied in the Summary worksheet, from multiple workbooks into one workbook. I hope that doesn't sound too confusing hahaha.

    Sorry to trouble, and I'll really appreciate the help!
    Last edited by bukit13; 12-02-2013 at 09:52 PM.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Extract selective data from multiple worksheets into a new workbook

    Try this amended. There's a new prompt now asking for the dealer's ID, and should now copy any number of columns. You did not post any sample workbook so it's difficult to visualize what went wrong for number 3. Did any error occur for that?



    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-02-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Extract selective data from multiple worksheets into a new workbook

    Oh it was my error, managed to figure it out. Apologies for that one.

    Yeap this works pretty well for now! Thanks a lot!

  6. #6
    Registered User
    Join Date
    12-02-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Extract selective data from multiple worksheets into a new workbook

    Alright, hahaha sorry to trouble again :/

    Let's say I've filtered the data I need in the Summary worksheet. Is it possible for write a macro that will do a lookup and copy the participants' name according to whatever IDs copied from the SUmmary worksheet?

    This is the current code I'm running which allows me to extract all the data from the Summary worksheets in all the workbooks, after I have filtered the data I need.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Extract selective data from multiple worksheets into a new workbook

    I am confused now. So you want participant's names to be in the same worksheet as Summary? Can you post a sample workbook (with sensitive information removed) showing how the desired results look like?

  8. #8
    Registered User
    Join Date
    12-02-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Extract selective data from multiple worksheets into a new workbook

    Sorry for the confusion. I've attached a sample of the end results I'm looking to get, note it's an example with only 2 dealers.
    Attached Files Attached Files

  9. #9
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Extract selective data from multiple worksheets into a new workbook

    I see that there's an additional column named "Company" now in Participants Name worksheet, is that taken from Summary worksheet? If so, which column is that?

    But you mentioned you want to copy participants' names.

    So which column/data should be copied, and from where to where?

  10. #10
    Registered User
    Join Date
    12-02-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Extract selective data from multiple worksheets into a new workbook

    Ohh I have missed that out in my first post, sorry about that. It's rightfully in the Participants Name worksheet.

    I wanna create a compiled workbook, with all the data in the "Summary" worksheet from the different workbooks, and all the data in the "Participants Name" worksheet corresponding to the IDs in the "Summary" worksheet copied.

    Which means I should have one big new workbook, which consists of "Summary" And "Participants Name" worksheets with all the data complied.

  11. #11
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Extract selective data from multiple worksheets into a new workbook

    Quote Originally Posted by bukit13 View Post
    Which means I should have one big new workbook, which consists of "Summary" And "Participants Name" worksheets with all the data complied.
    Right... it sounds just like what the code I've posted should be doing, is it not doing what it should be? Just in case you haven't realise, you can select more than one workbook when prompted by the macro, just Control+Click the file names.

  12. #12
    Registered User
    Join Date
    12-02-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Extract selective data from multiple worksheets into a new workbook

    Quote Originally Posted by millz View Post
    Right... it sounds just like what the code I've posted should be doing, is it not doing what it should be? Just in case you haven't realise, you can select more than one workbook when prompted by the macro, just Control+Click the file names.
    Hmmm alright. I'll try to figure it out. Thanks a lot anyway, really appreciate the help!

  13. #13
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Extract selective data from multiple worksheets into a new workbook

    No problem, but if the code is not working as intended maybe you need to explain in more detail what needs to be done and what not.

    Otherwise, if everything is fine, please mark the thread as [SOLVED].

+ 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. extract data from multiple worksheets and save to the respecting workbook
    By anitra in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-29-2013, 05:05 AM
  2. Extract Data from multiple worksheets within a workbook
    By gymnst920 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2013, 09:37 AM
  3. Importing selective data from multiple identical worksheets to master.
    By nknam in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2012, 06:56 PM
  4. Extract from multiple worksheets based on one condition and output to new workbook
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 01-23-2012, 05:05 PM
  5. Extract selective data from a spreadsheet
    By peter_cawley@ryder.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-05-2006, 12:00 PM

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