Date Format

  • Thread starter Thread starter Nicola
  • Start date Start date
N

Nicola

How can I change the date format in the header/footer from
looking like 10/17/03 to 17-Oct-03?
 
Nicola said:
How can I change the date format in the header/footer from
looking like 10/17/03 to 17-Oct-03?

I believe this is determined by the Regional Settings in Windows Control
Panel.
 
I don't know how to do that, but a work around for the
header is to insert a line at the top of your worksheet
and enter the date or a date formula (like Now())in the
location you want the date to print (left, center, or
right). Then, on Page Setup, on the Sheet tab, tell it to
repeat rows 1:1 on each page. To separate this "date
header" from the rest of the text, insert an additional
blank row and tell Page Setup to repeat rows 1:2 on each
page.
 
If you don't want to change your regional settings, one way is to
put this in your workbook's ThisWorkbook code module (right-click on
the workbook title bar, choose View Code, paste the following in the
window that opens, then click the XL icon on the toolbar to return
to XL):


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet

For Each wkSht In ActiveWindow.SelectedSheets
wkSht.PageSetup.LeftFooter = Format(Date, "dd-mmm-yy")
Next wkSht
End Sub


You can substitute CenterFooter or RightFooter for LeftFooter.
Likewise you could use LeftHeader, etc.
 
Back
Top