Forum Discussion
camille922
May 15, 2023Copper Contributor
Excel header/page #
I have a single worksheet that I need to print 150 pages of with sequential numbering pages in the header. For example: Truckload #1 - first page Truckload #2 - 2nd page etc. I cannot figure...
HansVogelaar
May 15, 2023MVP
If a macro would be acceptable:
Sub PrintPages()
Dim i As Long
For i = 1 To 150
Range("A1").Value = "Truckload #" & i
ActiveSheet.PrintOut
Next i
End Sub
You can change the cell and the text as needed.
camille922
May 16, 2023Copper Contributor
Thank you for replying. It 'sounds' like a good way to do that IF I wasn't juvenile in my Excel knowledge and knew what or how to do a macro!! LOL
Thanks though! I will just have to do it old school.
Camille
- HansVogelaarMay 16, 2023MVP
If you feel adventurous:
- Press Alt+F11 to activate the Visual Basic Editor.
- Select Insert > Module.
- Copy/Paste the code from my previous reply into the new window.
- If you want the "Truckload #nn" text in another cell than A1, change A1 in the code to the cell you want.
- With the insertion point anywhere in the code, press F5 to run the macro.
- Switch back to Excel.
- If you want to keep the macro, so that you can run it again later, save the workbook as a macro-enabled workbook (*.xlsm).
- camille922May 16, 2023Copper ContributorI figured it out. I had that sheet in a workbook with other tabs. Moved it to its own workbook. Printed fine!! Thank you so much!!
- camille922May 16, 2023Copper Contributor
Great instructions. Easy to follow... except it is giving me this error. ??
I have copy & pasted, and I have entered in myself. Same error.
- camille922May 16, 2023Copper ContributorYou are the BEST! I am always up for being adventurous!! ha
I will give it a whirl. Thank you for the instructions.