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
-
My 3 monitors go black & then the Taskbar is moved to center monitor
by
saturn2233
5 hours, 42 minutes ago -
Apple backports fixes
by
Susan Bradley
5 hours, 50 minutes ago -
Win 11 24H2 will not install
by
Michael1950
5 hours, 55 minutes ago -
Advice to convert MBR to GPT and install Windows 11 Pro on unsupported PC
by
Andy M
5 hours, 26 minutes ago -
Photos from iPhone to Win 10 duplicating/reformatting to .mov
by
J9438
7 hours, 34 minutes ago -
Thunderbird in trouble. Here comes Thundermail
by
Alex5723
5 hours, 43 minutes ago -
Get back ” Open With” in context menus
by
CWBillow
18 hours, 35 minutes ago -
Many AMD Ryzen 9800X3D on ASRock have died
by
Alex5723
22 hours, 22 minutes ago -
simple general stupid question
by
WSaltamirano
16 hours, 22 minutes ago -
April 2025 Office non-Security updates
by
PKCano
1 day, 9 hours ago -
Microsoft wants to hear from you
by
Will Fastie
9 hours, 29 minutes ago -
Windows 11 Insider Preview Build 22635.5160 (23H2) released to BETA
by
joep517
1 day, 12 hours ago -
Europe Seeks Alternatives to U.S. Cloud Providers
by
Alex5723
1 day, 18 hours ago -
Test post
by
Susan Bradley
1 day, 20 hours ago -
Used Systems to delete Temp files Gone WRONG what does this mean?
by
Deo
1 day, 22 hours ago -
SSD shuts down on its own
by
CWBillow
1 day, 13 hours ago -
OneDrive File Sharing Changes
by
David Clark
2 days, 6 hours ago -
OneDrive File Sharing Changes
by
David Clark
2 days, 8 hours ago -
Win 10 Pro 22H2 to Win 11 Pro 23H2 Conversion Guide
by
doneager
1 day, 8 hours ago -
Today is world backup day
by
Alex5723
2 days ago -
Windows .exe on Mint
by
Slowpoke47
5 hours, 9 minutes ago -
Reviewing your licensing options
by
Susan Bradley
6 hours, 3 minutes ago -
Apple has been analyzing your photos since September 2024
by
B. Livingston
1 day, 5 hours ago -
What Windows 11 24H2 offers beyond bugs
by
Lance Whitney
1 day, 1 hour ago -
Making sense of Settings in Windows 11
by
Simon Bisson
1 day, 2 hours ago -
Windows 11 pro fails to log in after upgrading Win 10 pro to Win 11 pro 24h2
by
ben_sitaud
2 days, 6 hours ago -
23H2 / 24H2 / Local v. Microsoft Account.
by
CWBillow
2 days, 4 hours ago -
YouTube Ad Blocker Blocker
by
bbearren
2 days, 4 hours ago -
Obscure historical facts about Windows
by
Cybertooth
2 days, 5 hours ago -
Microsoft Backup
by
Linda2019
1 day, 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.