Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Mar 2007
    Montreal, Quebec
    Thanked 0 Times in 0 Posts

    Formatting dates in footer (Windows, Excel XP)

    Hi gang,
    I inserted a date in a footer. How can I format it to MM DD YYY.
    Johanne Champagne
    Montreal (Quebec) CANADA

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Formatting dates in footer (Windows, Excel XP)

    The &<!t>[Date]<!/t> code you can insert into a custom header or footer always uses the Short Date format set in the Regional Settings control panel in Windows. If you want a different format, you can do it as follows:
    - Press Alt+F11 to activate the Visual Basic Editor.
    - Double-click ThisWorkbook in the tree view pane on the left hand side.
    - Enter or paste the following code into the module that appears:

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    ActiveSheet.PageSetup.LeftFooter = Format(Date, "mm dd yyyy")
    End Sub

    You can use CenterFooter or RightFooter instead of LeftFooter depending on where you want the date, and you can modify the format string "mm dd yyyy" to suit your preference.

    The code will be executed automatically each time the workbook is printed.
    Note: users will have to enable macros.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts