Forum Discussion

kitty2040's avatar
kitty2040
Copper Contributor
Jun 09, 2023

Excel 365 - Header, Footer, and Print area

I have an Excel workbook with 20 tabs.  

Each tab has a different header except the date after the description of the particular sheet.

I need every sheet to have a footer with a page number starting with page 2, being numbered 2.

 

The issues - When I group all the sheets and change the Headers date - all of them will change at one time (which is good).

However, It makes all the footer numbers to be whatever page I am on, that number.  In addition, it changes the print setup.

 

I have tried to go in and change the header and footer all at one time, but then when I get to the footer it will delete the header.  

 

IT's driving me insane.  I am not a novice...but just can't figure this out.

  • kitty2040 

    Run this macro:

    Sub SetPageNumbers()
        Dim wsh As Worksheet
        Application.PrintCommunication = False
        For Each wsh In Worksheets
            With wsh.PageSetup
                .FirstPageNumber = 2
                .CenterFooter = "&P"
            End With
        Next wsh
        Application.PrintCommunication = True
    End Sub

Resources