ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Page totals (https://www.excelbanter.com/excel-programming/304389-page-totals.html)

Buckosmasher

Page totals
 
Need to print multiple pages from several sheets. The first page may be a cover page and does not count in the total. I used the code to set the footer. The page numbers work but the total does not. If there are a total of three pages with the first being the cover I would like to see the first page after the cover say Page 1 of 2, but it displays page 1 of 31.

Sub TestFooter()

mOffsetPageCounter = "-1"
mrf = "&8Page " & "&P" & mOffsetPageCounter & " of " & "&N" & mOffsetPageCounter

With Sheets("sheet1").PageSetup
.RightFooter = mrf
End With

With Sheets("sheet2").PageSetup
.RightFooter = mrf
End With

mfooter = Sheets("sheet2").PageSetup.RightFooter

MsgBox mfooter
End Sub

Tom Ogilvy

Page totals
 
Your code worked fine for me.

--
Regards,
Tom Ogilvy

"Buckosmasher" wrote in message
...
Need to print multiple pages from several sheets. The first page may be a

cover page and does not count in the total. I used the code to set the
footer. The page numbers work but the total does not. If there are a total
of three pages with the first being the cover I would like to see the first
page after the cover say Page 1 of 2, but it displays page 1 of 31.

Sub TestFooter()

mOffsetPageCounter = "-1"
mrf = "&8Page " & "&P" & mOffsetPageCounter & " of " & "&N" &

mOffsetPageCounter

With Sheets("sheet1").PageSetup
.RightFooter = mrf
End With

With Sheets("sheet2").PageSetup
.RightFooter = mrf
End With

mfooter = Sheets("sheet2").PageSetup.RightFooter

MsgBox mfooter
End Sub





All times are GMT +1. The time now is 05:02 PM.

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