+ Reply to Thread
Results 1 to 6 of 6

Listing Worksheet Names based on a Workbook Name

  1. #1
    Registered User
    Join Date
    04-29-2010
    Location
    McLean, VA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    87

    Listing Worksheet Names based on a Workbook Name

    Friends,
    I have this code that someone helped me with that works well for retreiving the worksheet names from an opened workbook after inputing the name of a workbook in an input box. My problem with it, is that once you put the name of that workbook (from which you want to retreive worksheet names) in the input box and click enter, the names are listed starting in row two and then each consecutive time this code is entered, the names simply appear starting at the end of the worksheet names list. The revision I need to the code is for the worksheet names that appear, I need those to be over-ridden each time this code is executed.

    Example:

    1 - You open the input box in the below code by executing the macro.
    2 - You type in the name of an open workbook you have. Let's call it "Workbook 1."
    3 - Once you type "Workbook 1" and hit enter, all the names of all worksheets in Workbook 1 are listed on your current worksheet.
    4 - If this code is executed again, then I would like for those names that have been listed as a result of the code being run the first time, to be deleted and replaced with the worksheet names.
    Currently in this last step (step 4 above), when the code is executed a second time, the worksheet names are automatically listed below the previously executed code.

    Here is the code as it currently stands:
    Please Login or Register  to view this content.
    Last edited by The Exceller; 11-04-2013 at 01:36 PM.
    The Exceller
    If I helped you, please add to my reputation by clicking on the scale by my name in this post.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Listing Worksheet Names based on a Workbook Name

    Hi, The Exceller,

    one way:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,629

    Re: Listing Worksheet Names based on a Workbook Name

    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    04-29-2010
    Location
    McLean, VA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    87

    Re: Listing Worksheet Names based on a Workbook Name

    HaHoBe and protonLeah

    Thank you for the response. ProtonLeah, I cannot get your coded to execute, I get a 400 error.

    HahoBe,
    your code works well but I was hoping you could help modify one last thing for me. I need to be able to select the exact cell where the output happens, and I cannot figure out how to get that working properly. As of now, your code will put all worksheet names in column L starting in row 2. If I wanted the names to start in column B row 6, how would I accomplish that by revising the code? I just need to have the output cells flexible so I can change in the code as needed. Can someone help?

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Listing Worksheet Names based on a Workbook Name

    Hi, The Exceller,

    maybe like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    04-29-2010
    Location
    McLean, VA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    87

    Re: Listing Worksheet Names based on a Workbook Name

    Holger, This works fantastic. Thank you so much! If I have further questions, I may ask again, but this solves my problem for now. Thanks a lot!

+ 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. Listing worksheet names and extracting specific row data
    By boatbabe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-17-2011, 12:03 PM
  2. Listing worksheet names with total value
    By elevate in forum Excel General
    Replies: 0
    Last Post: 06-01-2011, 07:56 AM
  3. Listing tab names in one workbook in another workbook
    By SDruley in forum Excel General
    Replies: 9
    Last Post: 11-09-2010, 06:08 PM
  4. Listing Worksheet Names
    By wjsok85 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2010, 11:46 AM
  5. [SOLVED] listing all names in a worksheet
    By tthe in forum Excel General
    Replies: 4
    Last Post: 01-20-2006, 10:25 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