+ Reply to Thread
Results 1 to 10 of 10

searching multiple worksheets and collecting the results

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    searching multiple worksheets and collecting the results

    I have a large amount of data across multiple worksheets, the worksheets are not uniform in column or row number or column names (the data is from a variety of different sources!). I'm trying to create a macro to produce a search box and search all the worksheets for keywords that might appear in any cell and when found to then copy that entire row into a new sheet "Results". The search string is preferably for multiple words so that the search only needs to take place once. The aim of the macro is to provide a way for different offices to search for information that only they need so for example:

    Office A - searches for cats
    Office B - searches for cats & kittens
    Office C - searches for dogs

    The different offices can't be relied on to filter or individually search all the worksheets and I don't know exactly what each office is searching for to produce the results for them so this seemed the best way to search in a comprehensive way and to produce the data that they can then use themselves.

    I've been playing with this for a while and searching the site for tips and suggestions but haven't been able to create anything that functions in the way I need it to across multiple sheets. I can either get the search-box working or a single search-word function or the results sheet - not all of them working at the same time. Any suggestions on how to do this would be really appreciated...

  2. #2
    Registered User
    Join Date
    10-04-2012
    Location
    US
    MS-Off Ver
    Word, Excel, Access all 2007 & 2010. Outlook 2010
    Posts
    56

    Re: searching multiple worksheets and collecting the results

    Ideally you might have sample data, nothing confidential, that we could use to work with? This seems like a simple enough logic that I may be able to help without it though...

    Regards,
    K

  3. #3
    Registered User
    Join Date
    02-08-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: searching multiple worksheets and collecting the results

    Sorry - of course! This is a really short outline of the kind of spreadsheet I'm using, in real life there are thousands of lines of data.

    excel test.xlsx

    Essentially it is a collection of file references and more detailed account descriptions, we're trying to work out who needs to have access to what after the departure of a long-term member of staff.

  4. #4
    Registered User
    Join Date
    10-04-2012
    Location
    US
    MS-Off Ver
    Word, Excel, Access all 2007 & 2010. Outlook 2010
    Posts
    56

    Re: searching multiple worksheets and collecting the results

    Sorry for the delay; trying to pay the bills too.

    Is all the data in the same Workbook?

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

    Re: searching multiple worksheets and collecting the results

    Try this one

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-04-2012
    Location
    US
    MS-Off Ver
    Word, Excel, Access all 2007 & 2010. Outlook 2010
    Posts
    56

    Question Re: searching multiple worksheets and collecting the results

    Hi!

    Did AB33's solution work for you? Are all the worksheets in the same workbook?

    Since it has been a while since you've posted I'd like to know if you still need a solution as you've described. AB33's code failed for me but if it's working for you then that's great! Please reply with the needed answer here for me to continue.

    Cheers!
    K

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

    Re: searching multiple worksheets and collecting the results

    K,
    What is not working for you? It does work for me on the attached sample .

  8. #8
    Registered User
    Join Date
    02-08-2013
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: searching multiple worksheets and collecting the results

    Thanks guys - sorry to take so long to reply, I've been on holiday. This did work for me, thank you so much to you both for your help!

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

    Re: searching multiple worksheets and collecting the results

    Could you please now close this thread as solved. Go in to the top right-hand side of this page, choose "Thread Tools" you then select solved from the drop down menu?

  10. #10
    Registered User
    Join Date
    10-04-2012
    Location
    US
    MS-Off Ver
    Word, Excel, Access all 2007 & 2010. Outlook 2010
    Posts
    56

    Cool Re: searching multiple worksheets and collecting the results

    My absence was due to illness but I did have this almost together just before.

    #AB33
    In response to:
    Quote Originally Posted by AB33 View Post
    K,
    What is not working for you? It does work for me on the attached sample .
    1. I tend to work with "Option Explicit" so I first received a compile error on the variable "ms".
    2. Then again on variable "i".
    3. I received a Subscript out of range because I didn't first add the "Results" sheet.
    Then it worked great! ... but the only thing is that the last search item didn't populate with the row data, only the "Sheet" that you put in column "A".

    I also though the OP requested
    Quote Originally Posted by ibis10 View Post
    a macro to produce a search box
    which yours did not.

    I did have an alternative to handle multiple workbooks but since ibis10 likes your solution I pulled finishing that and came up with this.



    #ibis10

    You can add this to your personal.xlsm if you like to provide an always available macro; I've only added a Workbook_Open event to help in this example. Let me know if you have any troubles.

    Cheers!
    K
    Attached Files Attached Files

+ 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