Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know how to format &D or &T in Excel header or footer? I could use Format(Now, "yyyy/mm/dd HH:nn:ss") to get the format I wanted. But how do i do it with &D or &T?

share|improve this question

migrated from Oct 13 '09 at 18:35

This question came from our site for professional and enthusiast programmers.

You can do this using VBA:

With ActiveSheet.PageSetup 
    .RightFooter = "Printed " & Format(Time, "hh:mm") & " - " & Format _ 
    (Date, "mmm dd yyyy") 'Todays Date
End With
share|improve this answer

As per this Knowledge Base article: "These date and time formats are based on the Date and Time tabs in the Regional Settings Properties dialog box."

So you can change that setting, though that only solves the problem for the computer you're on. The other solution is to use JeffP's macro or a variant thereof.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.