View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How can I add present month, as number, to an header in excel?

Agnes

Could you live with a macro?

Sub Sheet_Date_Header()
ActiveSheet.PageSetup.RightHeader = ActiveSheet.Name & _
"-" & Format(Now, "mm") & _
"-" & Format(Now, "yy")
End Sub

If you want completely automatic you could use in a BeforePrint macro.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = ActiveSheet.Name & _
"-" & Format(Now, "mm") & _
"-" & Format(Now, "yy")
End Sub


Gord Dibben MS Excel MVP


On Thu, 21 Dec 2006 10:01:02 -0800, Agnes _TASOT <Agnes
wrote:

Have a work book with many sheets and want to have as part of a header:

"Sheet Name" - "Present Month" - "Present Year" that will update automatically

header would look like "name-12-06" was hoping I could do
&[Tab] - &[Month] - &[Year] the &[Tab] is ok, any thoughts on the rest.

Agnes