How change Date format in header?

  • Thread starter Thread starter Steve Adams
  • Start date Start date
S

Steve Adams

How can I get the date in my header to display: "September 9, 2004"

instead of "9/9/2004"


right now the custom header is: &[Date]
 
You'll have to use a little VBA.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Worksheets("sheet1").PageSetup.LeftHeader = Format(Date, "mmmm d, yyyy")
End Sub

Rightclick on the excel logo to the left of File (on the worksheet menubar) and
select view code.

Paste that code into the code window.

Adjust the worksheet name and .leftheader to what you want.

If you record a macro when you change the header, you'll see the syntax.

Steve said:
How can I get the date in my header to display: "September 9, 2004"

instead of "9/9/2004"

right now the custom header is: &[Date]
 
That works really neat, Dave. VBA is good stuff!

--
Thanks,
Steve


Dave Peterson said:
You'll have to use a little VBA.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Worksheets("sheet1").PageSetup.LeftHeader = Format(Date, "mmmm d, yyyy")
End Sub

Rightclick on the excel logo to the left of File (on the worksheet menubar) and
select view code.

Paste that code into the code window.

Adjust the worksheet name and .leftheader to what you want.

If you record a macro when you change the header, you'll see the syntax.

Steve said:
How can I get the date in my header to display: "September 9, 2004"

instead of "9/9/2004"

right now the custom header is: &[Date]
 
Back
Top