Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Combo Box Display
Hello Folks
Using VB 6.3 I have a combo box in a user for for selecting certain dates from the spreadsheet. The drop down works ok, but when I select a date the information displayed in the window is not the date. For instance I select 02/09/07 and the displayed value is 39122. How do I get the window to display 02/09/07 as opposed to 39122. I have the same problem with a time combo box. Thanks for your help |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Combo Box Display
hi,
39122 is the date number for 2/9/07. in your code you need to pre-format the cell to date. it should display date then. Regards FSt1 "bob leathers" wrote: Hello Folks Using VB 6.3 I have a combo box in a user for for selecting certain dates from the spreadsheet. The drop down works ok, but when I select a date the information displayed in the window is not the date. For instance I select 02/09/07 and the displayed value is 39122. How do I get the window to display 02/09/07 as opposed to 39122. I have the same problem with a time combo box. Thanks for your help |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Combo Box Display
How are you adding the items to the combobox?
Maybe it would be better to use something like: me.combobox1.additem format(whereeveryougetthedate, "mm/dd/yyyy") If this isn't sufficient, post back with some more details. Is the combobox on a userform -- or on a worksheet. And if it's on a worksheet, did you use the combobox from the control toolbox toolbar or from the dropdown toolbar? bob leathers wrote: Hello Folks Using VB 6.3 I have a combo box in a user for for selecting certain dates from the spreadsheet. The drop down works ok, but when I select a date the information displayed in the window is not the date. For instance I select 02/09/07 and the displayed value is 39122. How do I get the window to display 02/09/07 as opposed to 39122. I have the same problem with a time combo box. Thanks for your help -- Dave Peterson |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Combo Box Display
Drop the rowsource and use .additem inside the userform_initialize event.
Option Explicit Private Sub UserForm_Initialize() Dim myCell As Range For Each myCell In Worksheets("sheet999").Range("aa2:aa12").Cells Me.ComboBox1.AddItem myCell.Text 'or format(mycell.value,"mm/dd/yyyy") Next myCell End Sub And do the same thing with the times. bob leathers wrote: BTW I am also using Excel 2003 I am adding the data to a userform combo box from Cells in a spreadsheet (in combo box properties Row Source AA2:AA12). The cell Formats in the spreadsheet are "mm/dd/yy". When the user opens the form to add the date this data is displayed properly in the dropdown. When you select the date you want the serial date is substituted in the combo box window. I need to format the combo box to a "mm/dd/yy" format but don't know how. The same applies to the time function in another combo Box. Drpo down displays properly but serial time is displayed. I need to format this to a "hh:mm" format but again don't know how Thanks In article , says... How are you adding the items to the combobox? Maybe it would be better to use something like: me.combobox1.additem format(whereeveryougetthedate, "mm/dd/yyyy") If this isn't sufficient, post back with some more details. Is the combobox on a userform -- or on a worksheet. And if it's on a worksheet, did you use the combobox from the control toolbox toolbar or from the dropdown toolbar? bob leathers wrote: Hello Folks Using VB 6.3 I have a combo box in a user for for selecting certain dates from the spreadsheet. The drop down works ok, but when I select a date the information displayed in the window is not the date. For instance I select 02/09/07 and the displayed value is 39122. How do I get the window to display 02/09/07 as opposed to 39122. I have the same problem with a time combo box. Thanks for your help -- Dave Peterson |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Combo Box Display
This worked Great!!!!!
Thanks In article , says... Option Explicit Private Sub UserForm_Initialize() Dim myCell As Range For Each myCell In Worksheets("sheet999").Range("aa2:aa12").Cells Me.ComboBox1.AddItem myCell.Text 'or format(mycell.value,"mm/dd/yyyy") Next myCell End Sub And do the same thing with the times. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Combo Box Properties | Excel Discussion (Misc queries) | |||
Using Drop Downs Or Combo Boxes to Look up and display Info | Excel Discussion (Misc queries) | |||
Combo Box | Excel Worksheet Functions | |||
How do you display Greek and Russian languages in excel? | Excel Discussion (Misc queries) | |||
how i choose the column from a combo box | Excel Discussion (Misc queries) |