Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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?

Seone


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
3 months prior and 3 months post a date renee Excel Worksheet Functions 2 May 2nd 08 05:46 PM
Adding months to dates should account for 28-30-31 day months Graham Excel Worksheet Functions 3 February 1st 06 12:06 PM
converting months to years and months??? Marty Excel Discussion (Misc queries) 1 February 18th 05 02:38 AM
How do i change 15 months to read 1 year and 3 months? Marty Excel Discussion (Misc queries) 1 February 17th 05 11:21 PM
Dates to months and calculating values for their months jigsaw2 Excel Programming 1 September 5th 03 01:35 PM


All times are GMT +1. The time now is 07:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"