Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Month formula
Is it possible to have a Month formula in a custom header, so that as the new
month begins, the header will display the Name of the Month. Example, =Text(Today(),"mmmm") will show December right now in a cell, and when January arrives, will show January. But I want somehow to have the Month show up in the header, since others will be using the worksheet and don't want to have to change the header themselves. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Month formula
You could have a dedicated macro that you run once a month to update the
header--or you could change the header each time you open the file (or even each time you print the file). This changes the header each time the workbook is opened--whether it needs it or not: Option Explicit Sub Auto_Open() Dim wks As Worksheet Set wks = Worksheets("Sheet1") With wks.PageSetup .CenterHeader = Format(Date, "mmmm") End With End Sub I'd record a macro that formatted that header the exact way that I want it. Use XXXXX as the month name and replace "XXXXX" in the recorded code with Format(date,"mmmm"). If you need help post back with your current code. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Dar wrote: Is it possible to have a Month formula in a custom header, so that as the new month begins, the header will display the Name of the Month. Example, =Text(Today(),"mmmm") will show December right now in a cell, and when January arrives, will show January. But I want somehow to have the Month show up in the header, since others will be using the worksheet and don't want to have to change the header themselves. -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Month formula
Put this in the ThisWorkbook module.
Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet .PageSetup.CenterHeader = Format(Date, "mmmm") End With End Sub -- Don Guillett SalesAid Software "Dar" wrote in message ... Is it possible to have a Month formula in a custom header, so that as the new month begins, the header will display the Name of the Month. Example, =Text(Today(),"mmmm") will show December right now in a cell, and when January arrives, will show January. But I want somehow to have the Month show up in the header, since others will be using the worksheet and don't want to have to change the header themselves. |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Month formula
That worked perfectly. Now one last thing. I have 12 other tabs
(worksheets) that the macro should cycle through. Can you add the code for that. I know it should be something that has For Each sh............ Thanks. "Dave Peterson" wrote: You could have a dedicated macro that you run once a month to update the header--or you could change the header each time you open the file (or even each time you print the file). This changes the header each time the workbook is opened--whether it needs it or not: Option Explicit Sub Auto_Open() Dim wks As Worksheet Set wks = Worksheets("Sheet1") With wks.PageSetup .CenterHeader = Format(Date, "mmmm") End With End Sub I'd record a macro that formatted that header the exact way that I want it. Use XXXXX as the month name and replace "XXXXX" in the recorded code with Format(date,"mmmm"). If you need help post back with your current code. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Dar wrote: Is it possible to have a Month formula in a custom header, so that as the new month begins, the header will display the Name of the Month. Example, =Text(Today(),"mmmm") will show December right now in a cell, and when January arrives, will show January. But I want somehow to have the Month show up in the header, since others will be using the worksheet and don't want to have to change the header themselves. -- Dave Peterson |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Month formula
I have named the worksheets (FA2E), (FA2W), etc. When I leave the macro as
is (Sheet1) I get an error, subscript out of range. When I change Sheet1 to FA2E, which happens to be sheet1, it works. "Don Guillett" wrote: The one I presented will do it for all sheets everytime you print. -- Don Guillett SalesAid Software "Dar" wrote in message ... That worked perfectly. Now one last thing. I have 12 other tabs (worksheets) that the macro should cycle through. Can you add the code for that. I know it should be something that has For Each sh............ Thanks. "Dave Peterson" wrote: You could have a dedicated macro that you run once a month to update the header--or you could change the header each time you open the file (or even each time you print the file). This changes the header each time the workbook is opened--whether it needs it or not: Option Explicit Sub Auto_Open() Dim wks As Worksheet Set wks = Worksheets("Sheet1") With wks.PageSetup .CenterHeader = Format(Date, "mmmm") End With End Sub I'd record a macro that formatted that header the exact way that I want it. Use XXXXX as the month name and replace "XXXXX" in the recorded code with Format(date,"mmmm"). If you need help post back with your current code. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Dar wrote: Is it possible to have a Month formula in a custom header, so that as the new month begins, the header will display the Name of the Month. Example, =Text(Today(),"mmmm") will show December right now in a cell, and when January arrives, will show January. But I want somehow to have the Month show up in the header, since others will be using the worksheet and don't want to have to change the header themselves. -- Dave Peterson |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Month formula
sheet1 or sheets("fa2e") -- Don Guillett SalesAid Software "Dar" wrote in message ... I have named the worksheets (FA2E), (FA2W), etc. When I leave the macro as is (Sheet1) I get an error, subscript out of range. When I change Sheet1 to FA2E, which happens to be sheet1, it works. "Don Guillett" wrote: The one I presented will do it for all sheets everytime you print. -- Don Guillett SalesAid Software "Dar" wrote in message ... That worked perfectly. Now one last thing. I have 12 other tabs (worksheets) that the macro should cycle through. Can you add the code for that. I know it should be something that has For Each sh............ Thanks. "Dave Peterson" wrote: You could have a dedicated macro that you run once a month to update the header--or you could change the header each time you open the file (or even each time you print the file). This changes the header each time the workbook is opened--whether it needs it or not: Option Explicit Sub Auto_Open() Dim wks As Worksheet Set wks = Worksheets("Sheet1") With wks.PageSetup .CenterHeader = Format(Date, "mmmm") End With End Sub I'd record a macro that formatted that header the exact way that I want it. Use XXXXX as the month name and replace "XXXXX" in the recorded code with Format(date,"mmmm"). If you need help post back with your current code. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Dar wrote: Is it possible to have a Month formula in a custom header, so that as the new month begins, the header will display the Name of the Month. Example, =Text(Today(),"mmmm") will show December right now in a cell, and when January arrives, will show January. But I want somehow to have the Month show up in the header, since others will be using the worksheet and don't want to have to change the header themselves. -- Dave Peterson |
#8
Posted to microsoft.public.excel.misc
|
|||
|
|||
Month formula
This works great. Hats off to you.
"Don Guillett" wrote: Put this in the ThisWorkbook module. Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet .PageSetup.CenterHeader = Format(Date, "mmmm") End With End Sub -- Don Guillett SalesAid Software "Dar" wrote in message ... Is it possible to have a Month formula in a custom header, so that as the new month begins, the header will display the Name of the Month. Example, =Text(Today(),"mmmm") will show December right now in a cell, and when January arrives, will show January. But I want somehow to have the Month show up in the header, since others will be using the worksheet and don't want to have to change the header themselves. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formula for calculating 12 month rolling period | Excel Discussion (Misc queries) | |||
Weekday formula calculating to end of month | Excel Worksheet Functions | |||
Formula = Today's date + 1 month | Excel Worksheet Functions | |||
Formula Problem - interrupted by #VALUE! in other cells!? | Excel Worksheet Functions | |||
Formula for # of sales days in a month? | Excel Worksheet Functions |