View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Get a Date to show as a Date Format in Combo Box

What do you think this line is testing against?

If GetDate = CDate(cboGetDate.Value) Then

You haven't assigned anything to the GetDate variable so it doesn't have a
date in it that your ComboBox can be equated to. I'm also not too sure what
your code is supposed to be doing. I presume cboGetDate is the ComboBox..
you are trying to test if the item selected by the user is equal to GetDate
(which, as pointed out above, has nothing in it) and, if it did equal
GetDate, you are trying to format the entry the user selected and put it
back into the ComboBox??? Why aren't you just loading up the ComboBox with
the correct text to begin with? Perhaps you need to provide more detail
about your set up, why it is the way it is and what you are trying to change
about it? Right now, I am confused about what you are trying to do.

--
Rick (MVP - Excel)


"Jez" wrote in message
...
I have a combo Box which can select a date but it just displays as the
Number
format, I have this code below to change the format but doesnt seem to do
anything when I select a Date it still shows as a number format.
Where have I gone wrong?

Private Sub cboGetDate_Change()
Dim GetDate As Date
If GetDate = CDate(cboGetDate.Value) Then
cboGetDate.Value = Format(CDate(cboGetDate.Value), "dd/mm/yyyy")
Else
End If
End Sub