Forum Discussion
Format Date in header and footer
Hi everyone,
I like to stamp PDFs of excel docs with the current time and date via the footer (or header).
The "insert current date" function inserts the date in my system's default (DD/MM/YYYY) but I would prefer if I could customize it per document.
Any idea how this would be possible? TIA!!
Hi Joe,
It seems that there is no option to change the format through the Current Date and Current Time elements.
They always give you the date and time based on the default date format of the OS.
The format will not change unless you changed the default date format of the OS.
Regards
- Haytham AmairahSilver Contributor
Hi Joe,
It seems that there is no option to change the format through the Current Date and Current Time elements.
They always give you the date and time based on the default date format of the OS.
The format will not change unless you changed the default date format of the OS.
Regards
- Joe CangelosiCopper ContributorThank you!
- Willy LauSteel ContributorOnly VBA could help.
- James_KosalosCopper Contributor
It would be great if in fact this were true; unfortunately it is not. Excell doe NOT respect the date format set in the OS. I have been fighting this for years. Our arrogant, egocentric developers seem to have missed the fact that DD/MM/YYYY is NOT the international format. Date is a mixed radix number that is best presented in either an ascending or decending sequence. At the very least, there should be a way to use alphanumerics for the month to avoid confusion no matter the sequence. For instance, DD/MMM/YYYY or MMM,DD/YYYY. It appears this cannot be done with Excel. Too bad. Haytham Amairah
- s_ketharamanCopper Contributor
James_Kosalos Totally agree. Right now, my Windows Date is 22-Feb-2021 but the Date in Excel Header is 22-02-2021 whereas I want it to be 22-Feb-2021. I'm unable to find any way to change the format of the Date field in the Excel Header. I have tried Insert > Header and Footer, select Date. But the Number item on menu is dimmed. Looking forward to a solution! TIA.
- Kasra_AfroughCopper ContributorHello dear Joe,
You can use below code into "Worksheet_Activate" section in Excel (any version).
For Left Header Section:
Private Sub Worksheet_Activate()
ActiveSheet.PageSetup.LeftHeader = "&""Arial,Standaard""&16Date: " & Format(Now(), "d mmmm yyyy")
End Sub
OR
For Right Header Section:
Private Sub Worksheet_Activate()
ActiveSheet.PageSetup.RightHeader = "&""Arial,Standaard""&16Date: " & Format(Now(), "d mmmm yyyy")
End Sub
Note: The number between "&" and "Date" (16) is the font size.
You can change it as you wish!
______________
When you active (select) this sheet (with any name), the VBA set the date format of this sheet automatically and when you go to "Print Preview", the date will set based on your formatting order and current date.
Enjoy!