Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jim
 
Posts: n/a
Default Date Button in Header (Excel 2000)

Is there a way to change the format of the date button in the header? I get
12/11/04 and would like December 11, 2004.

Thanks,
Jim
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

I bet you're writing about File|page setup|Header/footer tab and clicking that
date button to insert the current date (you get this: &[Date] in the header
section.

If yes, you could type anything you want (a static date, though). Or you could
use a macro that sets the header whenever you print/print preview.

I recorded a macro when I changed the header. I got this code (after deleting
lots of stuff I didn't care about):

With ActiveSheet.PageSetup
.RightHeader = "&D"
End With

I could change it to:

With ActiveSheet.PageSetup
.RightHeader = format(date,"mmmm dd, yyyy")
End With

But if you live with what I did, you may lose stuff that you want.

So record your macro and modify it according to what you really want (along with
the date stuff).

But now you have to put that code in a special spot.

Inside the VBE (where that recorded macro is)
hit ctrl-r (to see the project explorer)
find your project and expand it using the +'s in front of each object. (Just
like Windows explorer and folders.)

When you see ThisWorkbook, double click on it and paste your code there.

But you'll have to modify it slightly. I used this:

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Me.Worksheets("sheet1")
.RightHeader = Format(Date, "mmmm dd, yyyy")
End With
End Sub

I only want the right header of worksheets Sheet1 to get that head--and I don't
want anything else to change.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



Jim wrote:

Is there a way to change the format of the date button in the header? I get
12/11/04 and would like December 11, 2004.

Thanks,
Jim


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I Break links Using Excel 2000 DaddyMan Excel Discussion (Misc queries) 1 December 9th 04 10:18 PM
Excel 2003 "File Open": how keep folders at top with sort by Date. Aging Analyst Excel Discussion (Misc queries) 1 December 3rd 04 03:26 AM
pivotcell object to excel 2000 Kellyc Excel Discussion (Misc queries) 0 December 1st 04 03:45 PM
How do I setup a spin button in excel Andy K Excel Discussion (Misc queries) 1 November 26th 04 09:08 PM
Creating a Date Selector in Excel VBA? Mark Excel Discussion (Misc queries) 0 November 25th 04 10:59 PM


All times are GMT +1. The time now is 08:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"