Forum Discussion

camille922's avatar
camille922
Copper Contributor
May 15, 2023

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 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.

    • camille922's avatar
      camille922
      Copper Contributor

      HansVogelaar 

      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

      • HansVogelaar's avatar
        HansVogelaar
        MVP

        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).

Resources