ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Date Format in Custom Header (https://www.excelbanter.com/excel-discussion-misc-queries/44217-date-format-custom-header.html)

Radsri-

Date Format in Custom Header
 
how do I change the date format to September 7, 2005 on Excel when I use
custom header

Richard Neville

Excel date formats in headers and footers depend on what's set in the
computer's "Regional Settings." To change settings, go to Start-Control
Panel-Regional and Language Options. Of course, you can always enter the
date manually in any format you want.

"Radsri-" wrote in message
...
how do I change the date format to September 7, 2005 on Excel when I use
custom header




JE McGimpsey

If you don't want to change your regional settings, or enter the date
manually, you can use VBA to automatically update the date. One way:

Put this in the ThisWorkbook code module:


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim ws As Worksheet
For Each ws In ActiveWindow.SelectedSheets
ws.PageSetup.LeftHeader = Format(Date, "mmmm d, yyyy")
Next ws
End Sub

Change LeftHeader to CenterHeader or RightHeader if desired.

If you're unfamiliar with macros, see

http://www.mvps.org/dmcritchie/excel/getstarted.htm


In article ,
"Radsri-" wrote:

how do I change the date format to September 7, 2005 on Excel when I use
custom header



All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com