+ Reply to Thread
Results 1 to 15 of 15

Lookup Number on "Summary" Sheet and Loop Through All Worksheets

  1. #1
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Hi I need to lookup a number on the "Summary" Sheet in Cell G2 and want it to loop through all worksheets until it finds the number, when it finds the number, I want it to return the worksheet name in cell B2 on the "Summary" Sheet. Have to do it for about 1000 unique numbers.

    Can anyone help??

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    This didn't work, it needs to return the worksheet name, instead its returning something completely different.

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    What is it returning? Can you post an example workbook that replicates the problem, along with what you are expecting it to return?

  5. #5
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    For example, it finds looks up number 103050 in G2 on the Summary tab, finds it on the 5th worksheet in Column G, then I want it to go back to Summary tab and put the 5th worksheet name as the value into cell B2.

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    That's what the code should be doing, and that's how it works for me when i test it. Again, please post example workbook that replicates the error, along with expected results.

  7. #7
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    I'm sorry it works, I adjusted, but you're awesome. Thanks!

  8. #8
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Sorry, how can I get it to search the loan, not on the entire worksheet, but only in column F (currently the code searches through the entire sheet).

  9. #9
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Switch out the Set c line with this

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Again you're awesome. Thanks

  11. #11
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Doesn't work!!! It doesn't return anything!!

  12. #12
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Again, would be really helpful if I could see an example workbook of yours that returns the error. The syntax is correct, so it could be anything from formatting to range discrepancies to variable types. Hard to diagnose blind.

  13. #13
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    See attached!
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    05-14-2013
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Any luck??

  15. #15
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Lookup Number on "Summary" Sheet and Loop Through All Worksheets

    Yes. I changed nothing, i just ran the code you have in the attached, and I got the results I would expect. See screenshot. Not sure what to tell you at this point.... Try running it again?

    vbkt.png

+ 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. Run Macros on all except "Summary" and "Reports" worksheets in a workbook
    By daralea in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2013, 05:42 PM
  2. Replies: 3
    Last Post: 05-31-2013, 05:16 AM
  3. [SOLVED] Need Macro to compile data from "Weekly" sheets and sum up into "Monthly" summary sheet
    By mo4391 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-21-2013, 07:25 PM
  4. Search multiple worksheets, copy and paste into "Summary" sheet
    By meowzers in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2010, 05:06 PM
  5. How do i create macro to count number of "Y" or "N" in different worksheets
    By tehseen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2009, 12:34 PM

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