View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
JP[_4_] JP[_4_] is offline
external usenet poster
 
Posts: 897
Default Get a date to display in date format on a UserForm

Another thought -- maybe you should be using CDate on Cells(2,13), not
on ComboBox1.Value.

Try it that way:

If IsDate CDate(Cells(2,13).Value) Then
ComboBox1.Value = Format(CDate(Cells(2,13).Value), "mm/dd/yyyy")
Else
MsgBox "Not a valid date format!"
ComboBox1.SetFocus
End If

Also check if you need to qualify "Cells(2,13)", it isn't clear what
worksheet that is coming from.


HTH,
JP


On Mar 21, 12:46*pm, ryguy7272
wrote:
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