by Allen Wyatt
(last updated July 22, 2021)
Dawn has workbooks with multiple tabs (worksheets) in them. She uses "Page of Pages" (X of Y) numbering in the page footers. She notes that she used to be able to print entire workbooks at once and have the numbering come out correctly, with the Y value being the number of pages in each worksheet. Since upgrading to Excel 2016, the Y value on her printouts is always the total number of pages in the workbook, not the number of pages in each worksheet. She wonders if there is a setting in Excel that determines how the Y value is counted (per worksheet or per workbook).
There is no setting that we've been able to locate. Instead, it appears that Excel determines both the X and Y values based on the current print job, not on worksheets or the entire workbook. In other words, if your workbook contains three worksheets, and you print all three, the X and Y values will be different than if you choose to print only the second or the second and third worksheets.
The solution to this is to use a small, simple macro that steps through all the worksheets in a workbook and prints the worksheets individually. As far as Excel is concerned, then, you are performing multiple print jobs, thus the Y value will get reset on a worksheet-by-worksheet basis. Here's the macro:
Sub PrintProperly() Dim sht As Worksheet For Each sht In ActiveWorkbook.Worksheets sht.PrintOut copies:=1 Next sht End Sub
Assign the macro to a shortcut key or to a button on the Quick Access Toolbar, and you'll be able to invoke it easier.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12454) applies to Microsoft Excel 2007, 2010, 2013, and 2016.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
When you have a worksheet that includes a long list of names, you may want the first and last names on each page to ...Discover More
Want to print different headers or footers on different parts of your worksheet? Excel has no inherent way to do this, ...Discover More
Setting up a single footer line for your printouts is fairly easy. If you want to move part of the footer down a line so ...Discover More