Excel header/page #

Copper Contributor

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 out how to get them to change with each print. 

Please advise!  

Camille 

6 Replies

@camille922 

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.

@Hans Vogelaar 

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

@camille922 

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).
You are the BEST! I am always up for being adventurous!! ha
I will give it a whirl. Thank you for the instructions.

@Hans Vogelaar 

Great instructions. Easy to follow...   except it is giving me this error.  ??

I have copy & pasted, and I have entered in myself.  Same error.

 

camille922_0-1684273933084.png

 

I 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!!