Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print 1 header on multiple sheets in a workbook? 2

Status
Not open for further replies.

Paladyr

Programmer
Apr 22, 2001
508
US
Is there a way to set the header and footer on all sheets in a workbook???
 
Paladyr : The only way I know how to do this is with a macro (I assume you already have the sheets in place). To avoid this I try and set the header/footers prior to creating additional sheets.

After modifying to suit your needs, run a macro like this for each sheet -

Sub Macro1()
'
With ActiveSheet.PageSetup
.LeftHeader = "&8&F"
.CenterHeader = "&8&D &T"
.RightHeader = "&8&P"
.LeftFooter = "&8&F : &A"
.CenterFooter = "&8&D &T"
.RightFooter = "&8&P of &N"
End With
End Sub
 
Hi,
Try this and fill in the appropriate text that you need...
Code:
    For Each Worksheet In Worksheets
        With Worksheet
            With .PageSetup
                .LeftHeader = ""
                .CenterHeader = "Common Header"
                .RightHeader = ""
                .LeftFooter = ""
                .CenterFooter = "Common Footer"
                .RightFooter = ""
            End With
        End With
    Next
:) Skip,
metzgsk@voughtaircraft.com
 
Hi Paladyr, a simple way is to group the sheets (click on the first sheet, hold down Shift and click on the last sheet, or use Control to select nonadjacent sheets). Then you can go into Header and Footer and key the header or footer once, and all grouped sheets will pick it up. Be sure to ungroup when you're done (hold down shift and click on the sheet tab).
 
I like dianemarie's solution - much more simple and direct!
A STAR for dianemarie - Thanx! :) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top