+ Reply to Thread
Results 1 to 22 of 22

Search across multiple worksheets

  1. #1
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Search across multiple worksheets

    Hi,

    I'd like to be able to do the equivalent of a vlookup across multiple sheets (160ish) all in the same workbook.

    IF POSSIBLE, id like to be able to search any keyword and return the entire row that it appears on, but im not sure if thats possible.

    Cheers in advance.

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Search across multiple worksheets

    Hello
    It is better to upload sample of your workbook with some dummy data and put some of the expected results
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    Hey!

    See attached.

    Just imagine alot more sheets!
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Search across multiple worksheets

    Give an example of search term that you would like to search for ..

  5. #5
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    Anything along them rows. Most likely Short code or Code (TST1 or TST-TST-TST-1)

  6. #6
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Search across multiple worksheets

    NOTE: I uploaded the wrong workbook. Please wait and I'll upload the correct one in a few minutes.
    I don't think a formula will do this, but here's a macro I came up with. This is case sensitive and circular, meaning it will continue to cycle through all results as long as you press "Yes". The items in red below can be added to make it stop after one search of all results.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Jeff Ho; 05-30-2018 at 10:46 AM.

  7. #7
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    Looks perfect mate.

    If i run into any issues, ill let you know.

    Cheers

  8. #8
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Search across multiple worksheets

    @marcosis please wait a minute. I uploaded the wrong workbook by mistake. Be back in a few minutes...

  9. #9
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Search across multiple worksheets

    Ok, try this one. It is not case sensitive, and it will continue to cycle through the search as long as you click "No" (not "Yes" as I mistakenly said before). Also, I added a "Cancel" option to quit the search without choosing one of the results. Here's the revised code:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    Hey,

    Thanks for this.

    We're really close but Ive come across a very strange issue. Certain terms that i know exist in multiple cells return only one result, and when i click no it just shows me that same selection, however many times i click no.

    Any idea why that would be?

    And (sorry) can we add a message box when none are found please.
    Last edited by marcosis; 05-31-2018 at 04:35 AM.

  11. #11
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72
    Quote Originally Posted by marcosis View Post
    Hey,

    Thanks for this.

    We're really close but Ive come across a very strange issue. Certain terms that i know exist in multiple cells return only one result, and when i click no it just shows me that same selection, however many times i click no.

    Any idea why that would be?

    And (sorry) can we add a message box when none are found please.
    Please provide a couple examples of the terms that only give one result. And, sure, we can add the Not Found notice.

    - Jeff

  12. #12
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    Im not sure how much it'll help as you cant see the data im searching, as its sensitive info.

    But we have a list of products that we sell and one of the popular ones has the word train in the title and theres easily 40 varieties. It finds the first and when you click no, it just shows you the first one again, no matter how often you press no.

  13. #13
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Search across multiple worksheets

    Trouble is I don't know how to replicate the problem. I tried partial text ("TST-TST") which is in many cells in the test workbook you uploaded, but it just returned each instance in turn.

    Try using Excel's built-in search and see if that finds them all. If not, then it may be some subtle difference in the data items. If it does, then it must be my code, but I have no way to find it on my side.

    Perhaps if you could create a small sample workbook that contains even one of the search terms that are affected, repeated four or five times, but then substitute dummy data for all the sensitive items. It only needs to be a few records, and possibly one worksheet. Just enough for me to see where the code loses the thread.

    Meanwhile, here's the revised code with the Not Found notice.

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Search across multiple worksheets

    By any chance are the terms you can't find part of formulas? I just tried a test using a formula. If the formula result displayed the term, the search found it, but not if it didn't display.

    That doesn't sound like what you're describing, but you might want to try this anyway: where the code defines the search, replace "Lookin:=xlValues" with "Lookin:=xlFormulas".
    Please Login or Register  to view this content.
    That will find values and formula terms.

  15. #15
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    They're just standard text values.

    As a test if i do a search (ctrl + F) it finds 38 records for "train" but only cycles through the same one, through the macro.

  16. #16
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    Ive just tried a slightly longer search for train tracks, because there are many varieties called "train tracks" and it started listing them all if i clicked no.

    Shouldn't the search for "train" find all of the ones listed "train tracks"

    Cheers

  17. #17
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Search across multiple worksheets

    Hmmm. Sorry about that. I'm afraid I don't know where to start looking for my error. There are many much smarter than me around here, so hopefully someone will be able to spot something.

  18. #18
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Search across multiple worksheets

    Hi Marcosis -

    I think I found the error. At some point I thought it would be a good idea to let the search keep repeating in case you didn't find the specific record you wanted the first time through. I think the problem is that the DO-LOOP never finishes on the first sheet where the term is found! It never moves on to the next sheet.

    Or you can remove the REMs (') from "' Start = c.Address" and "Loop While Not c Is Nothing 'And c.Address <> Start

    You can also just replace the entire macro with this code:
    Please Login or Register  to view this content.
    Please let me know if this resolves the issue.

    - Jeff

  19. #19
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    Thats absolutely amazing!

    Cheers mate.

    Much, much, appreciated

  20. #20
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    You dont have to do this part for me, because i know im being a pain, but is it easy enough to get it to paste row 1 and the current row of the result.

    Row 1 is always the table headers so it would help. If you tell me its pretty easy ill go away and do the research, rather than hassle you again!

  21. #21
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Search across multiple worksheets

    Figured it out.

    Cheers

  22. #22
    Registered User
    Join Date
    04-14-2018
    Location
    Vermont, USA
    MS-Off Ver
    Office 365
    Posts
    72

    Re: Search across multiple worksheets

    Glad it worked out.

+ 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. [SOLVED] Search multiple columns from Multiple Worksheets and copy rows into a Summary Worksheet
    By kljohn01 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-07-2017, 03:46 PM
  2. [SOLVED] Search for multiple cell contents in multiple text strings on two different worksheets
    By Sinistra in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-07-2017, 07:29 AM
  3. [SOLVED] Search multiple worksheets for search term and paste results in a summary sheet
    By Andy15 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 04-03-2017, 01:49 PM
  4. [SOLVED] Search box in Excel to search key words in sentences in multiple worksheets
    By fernandoii676 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2012, 01:42 PM
  5. Replies: 2
    Last Post: 10-19-2012, 11:11 AM
  6. Search Multiple Worksheets Against List of Non-Exact Search Criteria?
    By thump4r in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-17-2010, 03:46 PM
  7. Search across multiple worksheets
    By coupe2t in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2010, 11:04 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