Get a date to display in date format on a UserForm
dim s
With Me.ComboBox1
If Len(.Value) Then
On Error Resume Next
s = Format(CDate(.Value), "dd-mmm-yy")
On Error GoTo 0
If .Value < s And Len(s) Then .Value = s
End If
End With
Only change if it needs be or the combo's change even will run repeatedly;
as written above it'll fire when changed but only the once and of no
consequence.
ComboBox1.Value = Format(ComboBox1.Value, "mm/dd/yyyy")
End If
However, I just see 39539 in the ComboBox when I really want to see
4/1/2008.
I assume you really want to see 04/01/2008
Regards,
Peter T
"ryguy7272" wrote in message
...
How can I get a date to display in date format on a UserForm? I thought
it
would be something simple, such as the following:
If ComboBox1.Text < "" Then
ComboBox1.Value = Format(ComboBox1.Value, "mm/dd/yyyy")
End If
However, I just see 39539 in the ComboBox when I really want to see
4/1/2008.
Thanks in advance.
Ryan--
--
RyGuy
|