View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Karin Karin is offline
external usenet poster
 
Posts: 125
Default How do I change headers for all worksheets in a workbook?

I found this to be EXACTLY what I needed to create a macro that can be run
over and over to change a page footer. The document comes in monthly from
outside and this needs to be changed every month.

Thank you!

"Earl Kiosterud" wrote:

Frank,

This is about the dumbest reply that's been seen for a while. Too much
trouble. Use Paul's suggestion instead (unless there are other Page Setup
parameters that will be different -- in that case use my macro solution). I
was thinking you can't do page setup on more than one sheet. You can. You
can't with Sheet protection. This isn't about sheet protection. They'll
let anyone respond in these groups, won't they? Sorry.
--
Earl Kiosterud
www.smokeylake.com

"Earl Kiosterud" wrote in message
...
Frank,

I think you're referring to the custom header, in File - Page Setup. If
all the page setup parameters (margins, rows to repeat, etc.) are to be
the same for all sheets. Set up one sheet (File - Page setup). Then
select the remainder of the sheets and use Edit - Repeat Page setup. If
they're different, and you want only to put in a custom header, use this
macro:

Sub SetPageHeading()

Dim sht As Worksheet

For Each sht In Worksheets
With sht.PageSetup
.LeftHeader = ""
.CenterHeader = "My Page Heading, &""Arial,Italic""per se"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.PrintErrors = xlPrintErrorsDisplayed
End With
Next sht
End Sub

Substitute any lines as needed. You can record a macro as you set up and
format a custom header, then use the needed lines in this macro.
--
Earl Kiosterud
www.smokeylake.com

"frankfine" wrote in message
...
... without having to change the header on each worksheet individually.