Headers and Footers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
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
 
No should obviously be now

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

Regards,

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

Thanks for the correction, Peo!
 
Back
Top