View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Need help with Months in header

Use the BeforePrint event to update the Right Header with the information
you want.

--
Regards,
Tom Ogilvy


"Seonemj" wrote in
message ...

Trying to modify a macro to insert the same header and footer in all
worksheets. In the right header, I'd rather have a month instead and
year instead of all the date info. This is the one I'd like to use if
the date could be modified:

Sub InsertHeaderFooter()
' inserts the same header/footer in all worksheets
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
Application.StatusBar = "Changing header/footer in " & ws.Name
With ws.PageSetup
LeftHeader = "Company name"
CenterHeader = "Page &P of &N"
RightHeader = "Printed &D &Y "
LeftFooter = "Path : " & ActiveWorkbook.Path
CenterFooter = "Workbook name &F"
RightFooter = "Sheet name &A"
End With
Next ws
Set ws = Nothing
Application.StatusBar = False
End Sub

I've tried "&M" and many variations to no avail. Ideas?

Seone


--
Seonemj
------------------------------------------------------------------------
Seonemj's Profile:

http://www.excelforum.com/member.php...o&userid=32847
View this thread: http://www.excelforum.com/showthread...hreadid=526598