Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
3 months prior and 3 months post a date | Excel Worksheet Functions | |||
Adding months to dates should account for 28-30-31 day months | Excel Worksheet Functions | |||
converting months to years and months??? | Excel Discussion (Misc queries) | |||
How do i change 15 months to read 1 year and 3 months? | Excel Discussion (Misc queries) | |||
Dates to months and calculating values for their months | Excel Programming |