The model I’m working on has multi-page and single page worksheet printouts which are printed sequentially as separate print jobs, via macro. Is there a way to determine the total pages from the previous print job so that the next print job page number can be set sequentially.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Sequential Page Numbering
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Sequential Page Numbering
- This topic has 8 replies, 5 voices, and was last updated 24 years, 1 month ago.
Viewing 1 reply threadAuthorReplies-
WSforrests
AskWoody Lounger -
WSAnneD
AskWoody LoungerFebruary 23, 2001 at 11:46 am #516003Tks for your reply. The simplest solution is always the preferred one. However, I have the model set up so that within a worksheet, the output pages do not necessarily appear sequentially; e.g., a page of calculations may have an explanations page to the right, followed by several calculation pages beneath the first one.
What I had in mind was to somehow reference the &N value (Total Pages) available with Excel footer through VBA. Is this possible?
-
WSdcardno
AskWoody LoungerFebruary 23, 2001 at 5:07 pm #516043If you select the sheets to be printed (ctrl-click for non-adjacent sheets) the total number of pages will calculate correctly so the “page X of Y” will come out properly if you have that set in the footer.
If you do the equivalent action in VBA by adding the required sheets to the selection and then printing the selection, I imagine it would work properly, although I have not tried it. I’m off to waste a couple of sheets of paper – I’ll let you know!
-
WSdcardno
AskWoody LoungerFebruary 23, 2001 at 5:30 pm #516046Yup – it seems to work.
Try something like:
Sheets(Array("Summary", "Registration", "Memberships", "Equipment")).Select Sheets("Summary").Activate ActiveWindow.SelectedSheets.PrintOut
obviously, you’ll have to change the sheetnames to match your workbook!
and you should get what you need.
-
WSgwhitfield
AskWoody LoungerFebruary 23, 2001 at 7:27 pm #516061 -
WSdcardno
AskWoody LoungerFebruary 23, 2001 at 9:06 pm #516075I suppose I find that I am more likely to move a sheet than to rename it! Even if not, I think that using sheet names is preferable, since it is obvious what you are referring to; a user six months later looking at the code (say to add a sheet to the standard output) will see the names and understand the purpose, where the reference by index number may not tip them off….
If the code is to be used in another workbook, I would almost prefer that the sheetnames be used, since then I KNOW that the code won’t work, and will generate an error (subscript out of range, I expect), rather than ‘sort of’ working by printing sheets other than the ones I want (I can’t imagine that I would want the first, third, fourth and seventh sheets printed in two otherwise-unrelated workbooks!). Since I will have to modify the code anyway, I might as well set myself the task of looking for something meaningful to me, rather than to the computer.
-
-
-
-
-
WSHans Pottel
AskWoody LoungerFebruary 24, 2001 at 9:02 am #516151As far as I know, the only way to really determine the page count programmatically is to use the Excel 4 (XLM) Get.Document macro function. You can execute this macro function from VBA. Here you have some code that loops through all the worksheets in the active workbook and counts the number of pages.
Sub TotalNumberOfPages()
Dim Total As Integer
Dim Sht As Worksheet
Dim pg As Integer
Total = 0
For Each Sht In Worksheets
Sht.Activate
pg = ExecuteExcel4Macro(“Get.Document(50)”)
Total = Total + pg
Next Sht
MsgBox “Total Number of Pages to be printed = ” & Str$(Total)
End Sub -
WSAnneD
AskWoody Lounger
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Reviewing your licensing options
by
Susan Bradley
3 hours, 15 minutes ago -
Apple has been analyzing your photos since September 2024
by
B. Livingston
1 hour, 27 minutes ago -
What Windows 11 24H2 offers beyond bugs
by
Lance Whitney
26 minutes ago -
Making sense of Settings in Windows 11
by
Simon Bisson
6 hours, 15 minutes ago -
Windows 11 pro fails to log in after upgrading Win 10 pro to Win 11 pro 24h2
by
ben_sitaud
7 hours, 54 minutes ago -
23H2 / 24H2 / Local v. Microsoft Account.
by
CWBillow
10 hours, 50 minutes ago -
YouTube Ad Blocker Blocker
by
bbearren
14 minutes ago -
Obscure historical facts about Windows
by
Cybertooth
14 hours, 52 minutes ago -
Microsoft Backup
by
Linda2019
7 hours, 35 minutes ago -
What is the best notepad++ version for W7?
by
Picky
17 hours, 45 minutes ago -
What are right steps to move MS 365 Office+OneDrive files from PC to iMac?
by
glnz
1 day ago -
How to move existing MS 365 Office with OneDrive files from PC to new iMac
by
glnz
1 day ago -
How to move MS 365 files (some on OneDrive) from PC to iMac
by
glnz
1 day, 19 hours ago -
Microsoft adding Quick Machine Recovery to Windows 11
by
Alex5723
1 day, 20 hours ago -
Microsoft vs Passwords
by
Alex5723
1 day, 4 hours ago -
Windows 11 Insider Preview build 26200.5516 released to DEV
by
joep517
1 day, 23 hours ago -
Windows 11 Insider Preview build 26120.3653 (24H2) released to BETA
by
joep517
1 day, 23 hours ago -
Two March KB5053606 updates?
by
Adam
1 day, 17 hours ago -
MS Edge Not Updating to v134.0.3124.95 (rel. 27-Mar-2025)
by
lmacri
1 day, 17 hours ago -
Intel® Graphics/Sound Driver updates for 7th-10th Gen Intel® Core™ Processor
by
Alex5723
1 day, 20 hours ago -
Is there a comprehensve way to tranfer ALL current Edge Settings into a new Edge
by
Tex265
1 day, 18 hours ago -
Transferring ALL info/settings from current Firefox to new computer Firefox
by
Tex265
1 day, 18 hours ago -
DOGE Wants to Replace SSA 60 Million Line COBOL Codebase in Months
by
EyesOnWindows
56 minutes ago -
KB5051989 Usb printer Post Ipp
by
licencesti
2 days, 11 hours ago -
Removing bypassnro
by
Susan Bradley
10 hours, 51 minutes ago -
Up to 30 seconds to show “Recent Topics”
by
PL1
1 day, 16 hours ago -
Sound changes after upgrade from W11 23H2
by
WStaylorpsepa
17 hours, 14 minutes ago -
Windows bug blocks BIOS updates for Lenovo ThinkPad laptops
by
Alex5723
2 days, 21 hours ago -
O&O Software – ‘World Backup Day’ Sale
by
unbob
2 days, 17 hours ago -
Still version 23H2?
by
WSbxcfilm
2 days, 21 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.