XL: Macro to Change the Date/Time Format in a Header/Footer (213742)
The information in this article applies to:
- Microsoft Excel 2000
- Microsoft Excel 2002
This article was previously published under Q213742 For a Microsoft Excel 98 Macintosh Edition version of this article, see 184501.
For a Microsoft Excel 97 version of this article, see 161607.
SUMMARY
In Microsoft Excel, when you use the date code, &[Date], to insert the date
in the header or footer of a document, the date appears in the default
"MM/DD/YY" format. The time code, &[Time], appears in the default "H:MM
AM/PM" format. These date and time formats are based on the time settings
on the Date and Time tabs in the Regional Settings Properties dialog box.
To open the Regional Settings Properties dialog box, follow these steps:
- On the Start menu, point to Settings and then click Control Panel.
- Double-click Regional Settings in the Control Panel to open the Regional Settings Properties dialog box.
To use a date or time format other than the default format, use either of
the following methods:
- Manually type the time or date in the header or footer.
-or-
- Use a Visual Basic for Applications macro to change the format.
This article contains a sample macro that places the current date in the
header in the "MMM DD, YYYY" format.
REFERENCESFor more information about custom number formatting, click Microsoft Excel Help on the Help menu, type Create a custom number format in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
| Modification Type: | Minor | Last Reviewed: | 10/10/2006 |
|---|
| Keywords: | kbdtacode kbhowto kbProgramming KB213742 |
|---|
|