I would like to insert sequential page number across the entire workbook (there are two worksheets in the workbook.
Here is my code to insert page numbers:
ActiveWorkbook.Worksheets("Appendix A").PageSetup.CenterFooter = "&P of &N"
ActiveWorkbook.Worksheets("Summary").PageSetup.CenterFooter = "&P of &N"
答案 0 :(得分:1)
If you mean you want to write the index of the current sheet out of the entire number of sheets in your ActiveWorkbook
, then use the following code:
ActiveWorkbook.Worksheets("Appendix A").PageSetup.CenterFooter = "Page " & ActiveWorkbook.Worksheets("Appendix A").Index & " of " & ActiveWorkbook.Sheets.Count
ActiveWorkbook.Worksheets("Summary").PageSetup.CenterFooter = "Page " & ActiveWorkbook.Worksheets("Summary").Index & " of " & ActiveWorkbook.Sheets.Count