View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SIGE SIGE is offline
external usenet poster
 
Posts: 206
Default ActiveCell.Value changes with Format?

Hello There,

I have a cell (containing formula: =D1)
which is formatted as follows:

ddd dd-mmm-jj;;"<Double Click Me"

Upon launching a userform with a calendar it picks up the cell's value
or else takes current day.
Eventhough D1 = empty, my calendar shows me always: 5 march 2002, which
is value =37320

Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub

Anyone to overcome this?
Cheers Sige