0
votes

I have about 10 worksheets. I need to put sequential page numbers. Like if Worksheet A has 10 pages I need to put Page Numbers 1 thru 10 and start from Page Number 11 for Sheet B.

I am using a for loop across all worksheets to put the page numbers. Partial code:

For Each s In Worksheets
    s.Activate
    Application.PrintCommunication = False
    With ActiveSheet.PageSetup
       .CenterFooter = "&""Arial""&12" & "Page &P"
    End With
    Application.PrintCommunication = True
Next s

Now I don't want the page number to be printed for few of the sheets in between. How can I stop page number from being printed from these worksheets?

Thanks in advance!

1

1 Answers

0
votes

Just skip over the spacial sheets:

Sub dural()
For Each s In Worksheets
    If s.Name = "Special1" Or s.Name = "Special2" Then
    Else
        s.Activate
        Application.PrintCommunication = False
        With ActiveSheet.PageSetup
           .CenterFooter = "&""Arial""&12" & "Page &P"
        End With
        Application.PrintCommunication = True
    End If
Next s
End Sub