View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Combobox / Data Problems

What goes back to the mm/dd/yyyy hh:mm format?

You don't mean the selected item in the combobox, do you?

If you put that value into a cell, maybe you can just format the cell the way
you want--either manually or in code???

Matt wrote:

Guys,

I grabbed this code from Tom:

Private Sub UserForm_Initialize()
Dim Varr As Variant
ComboBox1.RowSource = ""
Varr = Worksheets("Sheet1").Range("A1:A12").Value
For i = LBound(Varr, 1) To UBound(Varr, 1)
Varr(i, 1) = Format(Varr(i, 1), "mmm-yy")
Next i
ComboBox1.List = Varr
End Sub

It now populates the combobox dropdown list with date in the correct
format and it doesnt show any of the exceldates 353434.2323) anymore.

But as soon as you leave the combobox and click anywhere else the date
goes back in the mm/dd/yyyy hh:mm format. Is there a way to force
Excel to leave the format that I defined in Tom's Code?

Matt


--

Dave Peterson