+ Reply to Thread
Results 1 to 11 of 11

Search text in worksheets + copy to new sheet

  1. #1
    Registered User
    Join Date
    06-10-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    12

    Search text in worksheets + copy to new sheet

    Hey,

    I've tried searching for an answer to my query but nothing quite works / fits - and I'm not really familiar enough with VBA to edit it enough to make it work.

    I have a workbook of many worksheets. Worksheet 1 has a list of names, with a header in row 1 "List", and below it are about 70 rows of alphanumeric one word text. I need to search all the other worksheets (worksheet 2 to the last worksheet) to see if any of those names in worksheet 1 appear. All the worksheets are formatted: column a + b + c + d contain data, row 1 is a header. In worksheet 2 onwards the alphanumeric one word text would appear in a text string in a cell. If they appear, I need to copy the entire row it was found in AND the title of the worksheet it was found in to a new worksheet.

    Attached is a template worksheet.

    Thanks!!
    Attached Files Attached Files
    Last edited by stonegwene; 07-01-2011 at 01:02 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Search text in worksheets + copy to new sheet

    Hello stonegwene,

    Are you searching for whole word matches or partial matches as well?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-10-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Search text in worksheets + copy to new sheet

    Whole word matches. If in worksheet 1, it says "AAAA" I need to only find "AAAA" in the other worksheets

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Search text in worksheets + copy to new sheet

    Hello ,

    If your example is true to the original data then a whole word match will not work with the example below:
    Name_Symbol=AAAA random info after
    The reason is a whole word match expects the word to have a space before and after the word unless it is the first or last word in the string.

  5. #5
    Registered User
    Join Date
    06-10-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Search text in worksheets + copy to new sheet

    Hmm.. that's fine - I can change the master list in sheet 1 to be "Name_Symbol=AAAA" then search for that string in the subsequent worksheets as they have a space "Name_Symol=AAAA [space] random info"

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Search text in worksheets + copy to new sheet

    Hello stonegwene,

    Using a partial match, I can set the macro to add an equal (=) in front of the AAAA and a space after it. But this would work only if the format were always =AAAA .

  7. #7
    Registered User
    Join Date
    06-10-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Search text in worksheets + copy to new sheet

    I can manually extract the "AAAA" or whatever the list name is, if somehow the row containing the cell of the partial match is copied over into the final worksheet, with the other details as specified above

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Search text in worksheets + copy to new sheet

    Hello stonegwene,

    Okay, I can do that for you.

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Search text in worksheets + copy to new sheet

    Hello stonegwene,

    This macro has been attached to a button on "Sheet1". The attached workbook has the macro and button added.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    06-10-2011
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Search text in worksheets + copy to new sheet

    Thanks - worked perfectly !!!

  11. #11
    Registered User
    Join Date
    04-23-2012
    Location
    Washington, USA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Search text in worksheets + copy to new sheet

    I'm working on a similar problem to this, but need to get all the values that match YYYY LLLL etc. This only seems to pull the first row that contains a cell with those characters. Any thoughts?

+ 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