Get a date to display in date format on a UserForm
Thanks guys, but it is not working. I tried the following:
Cells(2, 13) = ComboBox1.Value
If ComboBox1.Value < "" Then
ComboBox1.Value = Format(CDate(ComboBox1.Value), "mm/dd/yyyy")
End If
and this.............
Cells(2, 13) = ComboBox1.Text
If ComboBox1.Text < "" Then
ComboBox1.Text = Format(CDate(ComboBox1.Text), "mm/dd/yyyy")
End If
Neither attempt worked. Any other ideas? When I click the down arrow, the
dates appear as dates. When I click on a date (select it), it is converted
into its serial format (i.e., 39539). Appreciate any help with this....
--
RyGuy
"Peter T" wrote:
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
|