View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default format of combobox on userform

With the code below, there is no reformatting of the displayed text, so show
the code that fills the combos and any formatting you do.

Private Sub UserForm_Initialize()
With ComboBox1
.AddItem Now()
.ListIndex = 0
End With
End Sub

Private Sub ComboBox1_Click()
With ComboBox1
Debug.Print "Text :" & .Text & vbNewLine & "Value: " & .Value
End With
End Sub

********* Debug Output *******
Text :19/07/06 11:19:08 AM
Value: 19/07/06 11:19:08 AM

"red6000" wrote in message
...
Hi I have a combobox where the data is dates and a second where it is

time.

For the dates combox, the list happily shows the dates in my required

format
(ie dd mmm yyyy), but when you choose a date from the list it appears in

the
box in the serial date format (ie 39123).

A similar thing happens with times. If I choose 08:00 from the list, it
shows as 0.33333333 (ie 8/24).

Is there a way I can format the visible value of the chosen item from the
combobox list so that it appears as it does in the list?

Many thanks.