+ Reply to Thread
Results 1 to 8 of 8

Macro to search all sheets and return corresponding rows of searched value

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    59

    Macro to search all sheets and return corresponding rows of searched value

    HI all,
    I have a workbook with 13 sheets. Each sheet has 20,000+ rows. The format is the same on all sheets and columns A & B are unique (Item number & Item name). Currently, if someone needs to find information about an item, they have to use the find function, and go through the sheets. As you can imagine, this is time consuming and tedious.

    What I would like to do is:
    1. By the use of a userform or by any other method, type in the data you want to search.
    2. A macro will then loop through the sheets, find the corresponding rows, on all sheets, and paste it in another sheet. There will also be duplicates on all the sheets and they need to be included in the returned search.

    I've been looking online, and there are codes that compare or search through 2 sheets. Unfortunately, I do not have the expertise to modify these codes to suit them to my needs. I was hoping that someone can help me out or even point me in the right direction.

    Thanks

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Macro to search all sheets and return corresponding rows of searched value

    Hi,
    To understand the structure of your file, can you post a sample file with 2-3 tabs only and some rows (10 is enough).

  3. #3
    Registered User
    Join Date
    08-30-2012
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Macro to search all sheets and return corresponding rows of searched value

    Hi GC Excel,
    I've attached a sample. In the original file, all the columns have data, but in this example I didn't include all of them as they always keep changing.
    The 'Search' sheet shows the expected result. Sheet '1','2' and '3' contain the data. Fyi, cell colors do not matter.


    Thank you.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Macro to search all sheets and return corresponding rows of searched value

    Hi amar05,
    See attached file.
    Search criterias go in the yellow cells. You can use wildcard characters such as * and ?
    Macro is in Module1 :

    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Macro to search all sheets and return corresponding rows of searched value

    Another one
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-30-2012
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Macro to search all sheets and return corresponding rows of searched value

    Hi GC Excel & AB33,
    Both codes worked like a charm.

    Thanks for your help.

  7. #7
    Registered User
    Join Date
    12-18-2013
    Location
    chennai,india
    MS-Off Ver
    Excel 2010
    Posts
    24

    Thumbs up Re: Macro to search all sheets and return corresponding rows of searched value

    Tried running the macro.Really a great solution.
    For every search the result is getting cotinued from the previous search.Is it possible to clear the record for the next search such that it does not keeps on adding to so many rows.
    Pl help.

    Thanks
    Sanyaa

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to search all sheets and return corresponding rows of searched value

    Sanyaa,

    Welcome to the forum.

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Macro to search and highlight a cell prior to the searched cell
    By gjccks in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-15-2013, 01:51 PM
  2. Stopping VBA Search from showing error if searched item does not exist
    By viralshade in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2013, 09:37 PM
  3. Searched Named range and return multiple results
    By a.mack123 in forum Excel Programming / VBA / Macros
    Replies: 43
    Last Post: 10-10-2011, 10:24 PM
  4. Search for name across sheets and return most recent date
    By ccarr1025 in forum Excel General
    Replies: 7
    Last Post: 04-25-2011, 01:46 PM
  5. [SOLVED] Return SEARCHED Column Number of Numeric Label and Value
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 23
    Last Post: 01-30-2006, 02:20 PM

Tags for this Thread

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