View Single Post
  #3   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

Sorry that should actually be

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


On Mar 21, 11:46*am, JP wrote:
Have you tried the CDate function? Or IsDate?

If IsDate CDate(ComboBox1.Value) Then
ComboBox1.Value = CDate(ComboBox1.Value)
Else
MsgBox "Not a valid date format!"
ComboBox1.SetFocus
End If

(This is air code so step through first.)

HTH,
JP