Jun 09 2023 07:36 AM
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.
Jun 09 2023 07:51 AM
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
Jun 09 2023 12:22 PM
Thank you, but that did not work.
Jun 09 2023 12:46 PM
In what way did it fail?
Jun 12 2023 11:27 AM
Jun 12 2023 11:50 AM
Make sure that you haven't selected multiple sheets when you run the macro.
I have tested the macro; it does not change the page headers of the individual sheets, nor the print area.
It only sets the page number in the page footer.
Jun 12 2023 01:04 PM