Thread: Newbie question
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Newbie question

38701 is the value actually stored in the cell. If you format the cell as
general, you will see this number. It is the number of days since Dec 31,
1899.

To overcome this I usually either

a) use code to load the combobox and populate it with a text string
representing the date
Sub AddData()
For Each cell In Worksheets( _
"Sheet1").Range("A1:A10")
Worksheets("Sheet2").OLEObjects( _
"Combobox1").Object.AddItem cell.Text
Next

End Sub



b) use the click event rather than bind the output to a cell

Private Sub Combobox1_Click()
With worksheets("sheet2")
.Range("B9").Value = Format(Combobox1.Value,"mm/dd/yyyy")
End With
Combobox1.Value = Format(Combobox1.Value,"mm/dd/yyyy")
End sub

--
Regards,
Tom Ogilvy





"Barry Clark" wrote:


Ok. haha.

So, I have two sheets in this workbook that I am playing with.

I put a date, Thursday, December 15, 2005, in Sheet1 and cell A1.

I put a combobox on sheet two.

In the combobox properties, I populate the ListFillRange with 'sheet
1'!A1

When I pull the menu down, the date shows properly. When I click it and
the combobox collapses again, a numerical value of 38701 shows up. Any
thoughts?

Thank you,

Barry


--
Barry Clark
------------------------------------------------------------------------
Barry Clark's Profile: http://www.excelforum.com/member.php...o&userid=35267
View this thread: http://www.excelforum.com/showthread...hreadid=551024