Need help with Months in header



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?




Tom Ogilvy

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question