Formatting Question

  • Thread starter Thread starter Db1712
  • Start date Start date
D

Db1712

I need some help with the following: ‘Excel Version 2002’ I hav
inserted a Calendar Control into my spread sheet and linked it to
cell. My problem is that I want the date selected within the calenda
to return a date formatted as Monday, October 31, 2004. The linked cel
is formatted correctly, however when selecting dates within th
calendar, it will only return dates formatted as 10-31-2004. Thanks i
advance for any help with this matter
 
The problem is that the calendar control does not return a true date value,
it just returns a string that looks like a date.

You can do a couple things as a workaround - one is to move the linked cell
somewhere out of sight and put this formula in its place: =DATEVALUE(address
of LinkedCell). With the right date format you should get what you want.

Another approach is to use a macro to return a true date to a cell. First
get rid of the linked cell |(in Properties) since you don't need it any
more. Then go to the sheet's code module (right click on the sheet tab and
pick "view code") and paste in this code and edit the cell address as
necessary:

Private Sub Calendar1_Click()
Range("A1").Value = Calendar1.Value
End Sub

Give this cell (A1 in my example) the desired date format.

--
Jim Rech
Excel MVP
|
| I need some help with the following: ‘Excel Version 2002’ I have
| inserted a Calendar Control into my spread sheet and linked it to a
| cell. My problem is that I want the date selected within the calendar
| to return a date formatted as Monday, October 31, 2004. The linked cell
| is formatted correctly, however when selecting dates within the
| calendar, it will only return dates formatted as 10-31-2004. Thanks in
| advance for any help with this matter.
|
|
| --
| Db1712
| ------------------------------------------------------------------------
| Db1712's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=15912
| View this thread: http://www.excelforum.com/showthread.php?threadid=274086
|
 
Back
Top