ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   coding for footer,help please (https://www.excelbanter.com/excel-programming/356035-coding-footer-help-please.html)

kathy

coding for footer,help please
 
Hello,
I have 120 worksheets in one excel file.
I set print area in some sheets, some not.
I use macro to set up footer. Page number for the first 25 is right.
Then the next page number becomes 4,5,6,7...... ..
After several correct sequent pages, the
page number is wrong again. And repeat this again and again.....
Any comments?? Thanks.

Code is following:

Public Sub tester()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws.PageSetup
.LeftHeader = "&A"
.LeftFooter = "Page &P of &N"
End With
Next ws
End Sub


Tom Ogilvy

coding for footer,help please
 
You have to group your sheets before printing to get sequential numbers
across worksheets.

--
Regards,
Tom Ogilvy


"kathy" wrote in message
oups.com...
Hello,
I have 120 worksheets in one excel file.
I set print area in some sheets, some not.
I use macro to set up footer. Page number for the first 25 is right.
Then the next page number becomes 4,5,6,7...... ..
After several correct sequent pages, the
page number is wrong again. And repeat this again and again.....
Any comments?? Thanks.

Code is following:

Public Sub tester()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws.PageSetup
.LeftHeader = "&A"
.LeftFooter = "Page &P of &N"
End With
Next ws
End Sub





All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com