+ Reply to Thread
Results 1 to 6 of 6

Table of Contents Code Addition

  1. #1
    Registered User
    Join Date
    06-17-2014
    Location
    Here
    MS-Off Ver
    MS Office 2007
    Posts
    35

    Table of Contents Code Addition

    Hello,

    I have a worksheet that uses a table of contents code that was provided by a user on this forum.

    Once the table of contents sheet has been generated, I'd like to have a macro allow me to choose from a drop down menu a list of the sheets in order to print only that sheet. I have the code working using data validation, but I have to manually enter the name of each sheet rather than relying on the automatically generated table of contents.

    Essentially I'd like to have the printer macro reference the table of contents to allow a user to print the selected sheet based on available sheets listed in the table of contents.

    I have attached my workbook.

    Printer Macros.xlsm

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Table of Contents Code Addition

    Hi Building

    Not sure exactly where you're going with this.

    Create a Dynamic Named Range called "Sheets" with this Code in ThisWorkbook.Open Event
    Please Login or Register  to view this content.
    Add these lines of Code to the CreateTOC Code
    Please Login or Register  to view this content.
    Change Data Validation for Summary Cell B2 to =Sheets

    See attached.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    06-17-2014
    Location
    Here
    MS-Off Ver
    MS Office 2007
    Posts
    35

    Re: Table of Contents Code Addition

    Works perfectly, however the print function's code does not update to reflect added sheets. The code for the print button is as follow:

    Please Login or Register  to view this content.
    The code prints the selected sheet based off of the data validation from cell B2. Is there a way for the printer code to also update to reflect sheets added to the Table of Contents?

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Table of Contents Code Addition

    Hi Building

    Try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-17-2014
    Location
    Here
    MS-Off Ver
    MS Office 2007
    Posts
    35

    Re: Table of Contents Code Addition

    Worked perfectly, thank you!

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Table of Contents Code Addition

    You're welcome...glad I could help. Thanks for the Rep.

+ 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. Replies: 1
    Last Post: 08-04-2014, 09:51 AM
  2. [SOLVED] Removing a addition day from my VBA code
    By JonesyCC in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2013, 03:47 PM
  3. Cumulative addition from table
    By Africa in forum Excel General
    Replies: 0
    Last Post: 05-16-2012, 10:20 AM
  4. Table Of Contents- Code customization
    By maheshwow in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2012, 06:02 AM
  5. Replies: 3
    Last Post: 07-10-2007, 06:23 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