ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting sheet names as headers with page numbering (https://www.excelbanter.com/excel-programming/329196-setting-sheet-names-headers-page-numbering.html)

KimberlyC

Setting sheet names as headers with page numbering
 
Hi
Is there a way (before I print the activeworkbook) to set the header of each
worksheet in my workbook to the sheet's name plus the [page] number?

There can be many sheets in the activeworkbook with different names.... and
with many pages that print on each sheet (that's why I need the page number
at the end of each sheet's name in the header).

Any help on this would be greatly appreciated!!
Thanks in advance
Kimberly




Jef Gorbach

Setting sheet names as headers with page numbering
 

"KimberlyC" wrote in message
...
Hi
Is there a way (before I print the activeworkbook) to set the header of

each
worksheet in my workbook to the sheet's name plus the [page] number?

There can be many sheets in the activeworkbook with different names....

and
with many pages that print on each sheet (that's why I need the page

number
at the end of each sheet's name in the header).

Any help on this would be greatly appreciated!!
Thanks in advance
Kimberly




try this:

Sub title_pages()
'change month in center heading before running
For i = 1 To Sheets.Count
With Sheets(i).PageSetup
.LeftHeader = ""
.CenterHeader = _
"Company Name" & Chr(10) _
& "&A" & Chr(10) _
& Format(DateSerial(Year(Now), Month(Now) - 1, 1), "mmm-yyyy")
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "Page &P of &N"
.RightFooter = ""
End With
Next i
End Sub



Gord Dibben

Setting sheet names as headers with page numbering
 
Kimberly

Sub Name_in_Header()
For i = 1 To Sheets.Count
With Sheets(i).PageSetup
.CenterHeader = Sheets(i).Name & " Page &P"
End With
Next i
End Sub


Gord Dibben Excel MVP

On Wed, 11 May 2005 13:39:55 -0700, "KimberlyC"
wrote:

Hi
Is there a way (before I print the activeworkbook) to set the header of each
worksheet in my workbook to the sheet's name plus the [page] number?

There can be many sheets in the activeworkbook with different names.... and
with many pages that print on each sheet (that's why I need the page number
at the end of each sheet's name in the header).

Any help on this would be greatly appreciated!!
Thanks in advance
Kimberly




KimberlyC

Setting sheet names as headers with page numbering
 
Thank you!!
They both work well!!
"KimberlyC" wrote in message
...
Hi
Is there a way (before I print the activeworkbook) to set the header of

each
worksheet in my workbook to the sheet's name plus the [page] number?

There can be many sheets in the activeworkbook with different names....

and
with many pages that print on each sheet (that's why I need the page

number
at the end of each sheet's name in the header).

Any help on this would be greatly appreciated!!
Thanks in advance
Kimberly







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

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