+ Reply to Thread
Results 1 to 12 of 12

Search multiple worksheets for Text String, copy and paste entire row into new worksheet

  1. #1
    Registered User
    Join Date
    01-14-2013
    Location
    San Francisco Bay Area
    MS-Off Ver
    Excel 2010
    Posts
    6

    Search multiple worksheets for Text String, copy and paste entire row into new worksheet

    I need to search multiple worksheets for a text string (Customer Name) I enter and then copy and paste the entire row of all matches into a new worksheet (ideally with the Customer Name as the worksheet title) for further analysis.

    I have 18 worksheets in a workbook and the customer names are located in Column B of all the sheets. I have found threads with some similarities to my question but I don't know enough about VBA to understand how to edit the code to get what I need.

    I am using Excel 2010 and am attaching a sample workbook. Try customer names Sam Spade, Mary Jones or Fred Smith to test.

    Thanks for your help,

    Steve
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    Hi

    I notice that in your example file the 2007 sheet has a different set of headings from the other sheets. How do you expect to reconcile for the different column headings / positions?

    rylo

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    Maybe like this.

    See the attached file.

    Please Login or Register  to view this content.
    And after that i made an pivot table of it.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Registered User
    Join Date
    01-14-2013
    Location
    San Francisco Bay Area
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    I have data from two different sources and yes the headings don't match; but I have ensured that the information I need appears in the same columns.

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    Hi

    So you only want to bring across the data from columns A-B, G-O to the consolidated sheet?

    rylo

  6. #6
    Registered User
    Join Date
    01-14-2013
    Location
    San Francisco Bay Area
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    Actually, after I looked back at my data, I realized it would be easy to reconcile by adding the missing columns to each sheet so all data will match. I've done that now.

  7. #7
    Registered User
    Join Date
    01-14-2013
    Location
    San Francisco Bay Area
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    This looks great but when I copy the module to my full worksheet and run the macro I get: Run-time error '9': Subscript out of range

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    Steve,
    I wrote the code you have attached on your workbook, but for different reason and purpose. The code was meant to look for a string(value) which is in Range C3 and when it finds, it copies that row in to a different sheet. In fact, the original code was looking across multiple sheets, but the OP has latter requested to change it to look at single sheet.

    http://www.excelforum.com/excel-prog...html?p=3078646
    Last edited by AB33; 01-15-2013 at 07:20 AM.

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    did you add an worksheet with the name consolidated?

    this has to be done, otherwise the macro don't know where to put the data.

  10. #10
    Registered User
    Join Date
    01-14-2013
    Location
    San Francisco Bay Area
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    Oh! That's the problem! I'll try that now.

    Thank you so much,

  11. #11
    Registered User
    Join Date
    01-14-2013
    Location
    San Francisco Bay Area
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    Thanks to oeldere for the solution to my problem. The code worked once I added the Consolidated sheet and I'm learning to use the Pivot Table to view the data in different ways. Great solution!

    Thanks so much for your help.

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Search multiple worksheets for Text String, copy and paste entire row into new workshe

    Thanks for the reply.

    Glad i could help.

    If the question is solved, will you mark it as solved?

    You can also thank the person who helped you by clicking on the star.

+ 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