Combobox/Rowsource - loses date/time format

S

systemx

Hi there,

Hopefully a simple one. On a userform I have developed there are
several comboboxes that use data on a worksheet as the rowsource.

This data is in either date/time format.

The list populates in the combo in date/time format, but once a value
is selected, the value displayed is the actual number that corresponds
with the selection, not the date itself (i.e. it loses the date/time
formatting).

i.e. user will 20/08/2006 when making a selection from the combo, once
selected the user will see 38949.

Does anyone know how to stop this occurring so that the date/time is
always visible?

Thank you

Rob
 
N

Norman Jones

Hi Rob,

Try something like:

'=============>>
Private Sub ComboBox1_Change()
With Me.ComboBox1
.Value = Format(.Value, "dd/mm/yy h:mm")
End With
End Sub
'<<=============
 
S

systemx

Hi Norman,

Thank you for the help mate. It worked perfectly. The other method tha
worked for me was to setup the source data as 'text', then format i
after it was spat back out of the userform.

Cheers

Ro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top