Macros

G

Gord Dibben

Russ

If you select all sheets(right-click on one and "select all sheets") you can
set the header on all by setting one the active sheet.

If you want a macro.........

Sub Path_All_Sheets()
Set wkbktodo = ActiveWorkbook
For Each ws In wkbktodo.Worksheets
ws.PageSetup.RightHeader = ActiveWorkbook.FullName & " " & Chr(13) _
& Application.UserName & " " & Date
Next
End Sub


Gord Dibben Excel MVP

On Wed, 24 Nov 2004 11:05:03 -0800, Thanks, Russ <Thanks,
 
J

JE McGimpsey

First, you probably don't need to use macros. Select all the worksheets
(select the left-most, then Shift-click on the right-most), then create
the Header.

If you need to use a macro, modify something like this:

Public Sub AllHeaders()
Dim wsSheet As Worksheet
For Each wsSheet In Worksheets
With wsSheet.PageSetup
.LeftHeader = "This goes on the left"
.CenterHeader = "This goes in the center"
.RightHeader = "This goes on the right"
End With
Next wsSheet
End Sub
 
Top