+ Reply to Thread
Results 1 to 5 of 5

VBA to insert sequential page numbers of visible worksheets ONLY

  1. #1
    Registered User
    Join Date
    02-01-2012
    Location
    OH
    MS-Off Ver
    Excel 2010
    Posts
    3

    VBA to insert sequential page numbers of visible worksheets ONLY

    I have a workbook with 10 or so worksheets. The first worksheet is an 'input' page, and depending on what kinds of information the user inputs, some of the other worksheets either get hidden or unhidden.
    At the bottom of the input page I have a button which then prints the workbook to a pdf. When it prints, it is only printing the visible worksheets, not the hidden ones.

    I am attempting to figure out how to have page numbers appear on the bottom (footer) of the pages, but the page numbers need to start at 1 for the first VISIBLE worksheet and continue sequentially for all the VISIBLE worksheets so that the final pdf has page numbering that makes sense. My VBA "print to pdf" button hides the Input page so I don't have to worry about that being 'visible' when numbering.

    Any thoughts?

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,700

    Re: VBA to insert sequential page numbers of visible worksheets ONLY

    Do you save the non hidden worksheets to a single PDF or a PDF for each visible sheet?
    The first thing the code does is hide your "input" sheet and then print the visible sheets to PDF? That is the way it sounds.

  3. #3
    Valued Forum Contributor
    Join Date
    05-03-2022
    Location
    Halifax,Canada
    MS-Off Ver
    365
    Posts
    326

    Re: VBA to insert sequential page numbers of visible worksheets ONLY

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,700

    Re: VBA to insert sequential page numbers of visible worksheets ONLY

    For individual pdf files, this should do that.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,700

    Re: VBA to insert sequential page numbers of visible worksheets ONLY

    If you want it in a single PDF file, this would do that.
    Change the "Whatever you want to name it" in the code to the name of your file.
    Please Login or Register  to view this content.

+ 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] Insert rows and sequential numbers
    By coach.32 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-15-2014, 08:39 PM
  2. Printing sequential Page numbers on each copy printed.
    By jhansen04 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2013, 01:44 PM
  3. Replies: 1
    Last Post: 12-07-2008, 12:21 PM
  4. Sequential Numbers per page copy
    By JBeaucaire in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-27-2008, 02:50 PM
  5. [SOLVED] print multiple copies of the same page with sequential numbers
    By labrat in forum Excel General
    Replies: 1
    Last Post: 06-14-2005, 01:05 PM
  6. [SOLVED] How can i print sequential page numbers 1 to 10, if i have one wo.
    By DJN822 in forum Excel General
    Replies: 2
    Last Post: 03-24-2005, 01:07 AM
  7. [SOLVED] Sequential page numbers for one page
    By Ivan in forum Excel General
    Replies: 3
    Last Post: 03-11-2005, 03:07 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