+ Reply to Thread
Results 1 to 11 of 11

Generate dynamic list of Sheets

  1. #1
    Forum Contributor
    Join Date
    02-26-2014
    Location
    Aylsham, Norfolk, UK
    MS-Off Ver
    Excel 365
    Posts
    126

    Generate dynamic list of Sheets

    Hi All,

    I am trying to get some code to essentially generate a list of the Worksheets within the same Workbook. I would like to the list to be populated starting from Cell B20 of the sheet named Home.

    The home sheet will always be the first sheet, there are two hidden sheets after that which will always be the next 2 sheets and I would like them excluded from the list. There will be no other hidden sheets so it could simply list all the visible sheets excluding the home if that is easier to do.

    Thank you in advance.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: Generate dynamic list of Sheets

    What are the names of the hidden sheets?
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    02-26-2014
    Location
    Aylsham, Norfolk, UK
    MS-Off Ver
    Excel 365
    Posts
    126

    Re: Generate dynamic list of Sheets

    Data
    Template

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: Generate dynamic list of Sheets

    Please Login or Register  to view this content.
    EDIT: Corrected Or to And
    Last edited by alansidman; 11-20-2019 at 08:22 PM.

  5. #5
    Forum Contributor
    Join Date
    02-26-2014
    Location
    Aylsham, Norfolk, UK
    MS-Off Ver
    Excel 365
    Posts
    126

    Re: Generate dynamic list of Sheets

    Wow that was quick!

    Is there anyway to make it auto update?

    Works perfectly, although it still lists the Home sheet (which isn't really a major issue.

    Thank you again.

    EDIT: Just realised that the attached file has the first edit of code.
    Attached Files Attached Files

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Generate dynamic list of Sheets

    Small ammendment.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: Generate dynamic list of Sheets

    @Bakerman


    I've never seen this convention before. I clearly understand what you are doing, but where do I learn about this convention. Can't seem to find anything on the Inter Web.

    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Generate dynamic list of Sheets

    I don't think what bakerman2 used is so much a convention as it is simply an understanding that logical expressions have numeric equivalents that can be manipulated mathematically and that any non-zero number is considered as being True by the If statement. I would imagine that you might have come across this type of usage in array formulas where one might want to avoid using the AND function.
    Last edited by Rick Rothstein; 11-21-2019 at 03:50 AM.

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,410

    Re: Generate dynamic list of Sheets

    Here is another macro that can be considered...
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    02-26-2014
    Location
    Aylsham, Norfolk, UK
    MS-Off Ver
    Excel 365
    Posts
    126

    Re: Generate dynamic list of Sheets

    Thank you all for your help.

    I've added the script to an existing Macro which makes it all work "dynamically" perfect now.

    What I love about VBA is how there are always multiple approaches to the same problem, thank you again.

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: Generate dynamic list of Sheets

    @Rick

    Thanks for the explanation.

    Alan

+ 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] auto generate titles to multiple sheets from a list
    By dtorres4043 in forum Excel General
    Replies: 10
    Last Post: 10-21-2015, 11:43 AM
  2. [SOLVED] How to generate a list of all Sheets within a workBOOK
    By xtreme4u in forum Excel General
    Replies: 1
    Last Post: 09-30-2014, 05:39 PM
  3. [SOLVED] Generate a pending list from multiple sheets
    By stevense28 in forum Excel General
    Replies: 11
    Last Post: 03-26-2014, 02:27 PM
  4. Replies: 5
    Last Post: 11-16-2011, 01:25 PM
  5. Looping through an Excel list to generate a dynamic Word document
    By Nabla21 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-30-2011, 09:25 AM
  6. Need a VB code to generate sheets from a list of cells
    By Thanatos in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-07-2008, 08:14 AM
  7. Excel Generate List from Multiple Sheets
    By Scorpio in forum Excel General
    Replies: 5
    Last Post: 05-16-2008, 01:20 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