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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel header across entire workbook? 1

Status
Not open for further replies.

GVN

MIS
Dec 2, 2005
238
US
Anyone know how to set an Excel header across an entire workbook instead of just per sheet?

GVN
 
Here's a VBA option...
Code:
Sub SetHeader_AllWorksheets()
    Dim ws As Worksheet
    Application.ScreenUpdating = False
    For Each ws In Worksheets
      ws.Select
        With ActiveSheet.PageSetup
        .LeftHeader = "&D   &T"
        .CenterHeader = "Sample Heading"
        .RightHeader = "Page &P"
        End With
    Next
    Sheets(1).Select
    [a1].Select
    Application.ScreenUpdating = True
End Sub
Hope this works for you. :)

Regards, Dale Watson
 
If I change "Sample Heading" with "&[Tab]" will it put all the Tab names in each of them? That's ultimately what the user wants to happen...

GVN
 
Code:
If I change "Sample Heading" with "&[Tab]" will it put all the Tab names in each of them?  That's ultimately what the user wants to happen...

GVN
 
& and the Tab is what I'm trying to say... This stupid forum keeps removing it everytime I enter it into the message body.........
 
This code:

Sub SetHeader_AllWorksheets()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Select
With ActiveSheet.PageSetup
.CenterHeader = "&[Tab]"
End With
Next
Sheets(1).Select
[a1].Select
Application.ScreenUpdating = True
End Sub


doesn't save the edits until you go in and click OK on each header for each page. It enters the code into the header field, but just doesn't "commit" it...

GVN
 
[offtopic]
FYI: [ignore][tab][/ignore] is processed as TGML and inserts an actual TAB into the text. I am able to represent [ignore][tab][/ignore] by acutally typing in [ignore][ignore][tab][/ignore][/ignore].

Click the Process TGML link below the posting box for more TGML formatting options.
[/offtopic]


[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
An alternative to code:
Click on the first tab, hold down shift and click on the last tab. Now make the header.

Lilliabeth
-Why use a big word when a diminutive one will do?-
 
Thanks Lilly! It works!!!

GVN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top