Headers and Footers

S

Shady

How can I keep a header on the first page of a report only? I don't need it on the next 23 pages, and I can't remove it. Any suggestions?
 
J

JE McGimpsey

One way:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Const sFOOTER As String = "my footer"
Dim wsSheet As Worksheet
Cancel = True
Application.EnableEvents = False
For Each wsSheet In ActiveWindow.SelectedSheets
With wsSheet
.PageSetup.LeftFooter = ""
.PrintOut from:=1, To:=1
.PageSetup.LeftFooter = sFOOTER
.PrintOut from:=2
End With
Next wsSheet
Application.EnableEvents = True
End Sub


Substitute CenterFooter or RightFooter for LeftFooter as applicable.

This prints the footer on the first page of every sheet.
 
P

Peo Sjoblom

No the OP only have to change it to a header instead of a footer and
everything
will be Hunky Dory <g>

--
For everyone's benefit keep the discussion in the newsgroup.

Regards,

Peo Sjoblom
 
P

Peo Sjoblom

No should obviously be now

--
For everyone's benefit keep the discussion in the newsgroup.

Regards,

Peo Sjoblom
 
J

JE McGimpsey

Oops - must have gotten Footer stuck in my head from the Subject line.

Thanks for the correction, Peo!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top