Use an Excel VBA Macro to Number and Print Three-Page Sets
Question details
The user needs to print repeated three-page sets from Excel, with one sequential number shared by all pages in each set.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet needs to be printed multiple times as three-page sets numbered 001, 002, 003, and so on.
- Observed behavior
- Each print operation should produce three pages displaying the same three-digit set number, with the number increasing for the next set.
Choose a cell for the set number and make sure its row and column can appear on every printed page. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm) and enable macros only if you trust the file.
Print each numbered set with an Excel VBA loop
Use this method when each print operation should produce the same three worksheet pages with a new set number.
The macro writes a number to J3 and prints the worksheet once per set. Formatting the cell as 000 displays numbers such as 001 without changing their numeric values.
Select the worksheet range to print, including column J, then choose Page Layout > Print Area > Set Print Area.
Choose Page Layout > Print Titles and set Rows to repeat at top to $3:$3. Make sure J3 is visible and that column J appears on every printed page; adjust the layout if the worksheet spans multiple pages horizontally.
Open File > Print and inspect all pages in Print Preview. Adjust scaling, margins, or page breaks until one print operation produces exactly three pages, each showing J3.
Press Alt+F11, choose Insert > Module, and paste this code. Replace Sheet1 with your worksheet name and change the first and last numbers as needed: Sub PrintSets() Dim ws As Worksheet Dim n As Long Dim firstNumber As Long, lastNumber As Long Set ws = ThisWorkbook.Worksheets("Sheet1") firstNumber = 1 lastNumber = 10 ws.Range("J3").NumberFormat = "000" For n = firstNumber To lastNumber ws.Range("J3").Value = n ws.PrintOut Next n End Sub
Return to Excel, select the intended printer in File > Print, then press Alt+F8, select PrintSets, and click Run. The example prints 10 sets, numbered 001 through 010.

Prepare and Print Spreadsheet Pages with WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing spreadsheets. Its format compatibility helps you move existing workbooks into WPS, although it does not fix Excel-specific VBA issues and macro support may vary by version.

Frequently Asked Questions
How do I change the starting and ending set numbers?
In the VBA module, change the firstNumber and lastNumber assignments. For example, use 11 and 20 to print sets numbered 011 through 020.
Why does the number appear on only the first page?
Go to Page Layout > Print Titles and set the row containing the number as a repeating top row. Also check File > Print to confirm that the number cell's column appears on every page.
How can I make Excel display 001 instead of 1?
The macro sets J3's number format to 000. You can also select the cell, open Format Cells > Number > Custom, and enter 000.
What if the worksheet prints more or fewer than three pages?
Open File > Print and adjust scaling, margins, the print area, or page breaks. Check the preview again before running the macro.
Can I use a different cell for the set number?
Yes. Replace both references to J3 in the macro with your chosen cell, then configure Page Layout > Print Titles and the print area so that cell appears on every page.




