Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Format In Combobox
sI have a Combobox whose RowSource is a list of dates for the current and
last year. When I display the dialog, the Combobox shows the dates as their values as opposed to January 2007, etc. Picking up on another thread, I have inserted in the activation code for the dialog the command: Me.MonthSelectedBox.Value = Format(Me.MonthSelectedBox, "mmmm yyyy") where the Combo is called MonthSelectedBox. However, I still get the value. Thanks in advance for any ideas. Ian |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Format In Combobox
It's not crystal clear to me what you mean. If the dates are formatted
in the cells of the RowSource as January 2007, then they appear that way in the ComboBox when the entire list is shown. However, after selecting one, such format isn't shown for the selected value. So I guess that's what you mean. If you want the selected value formatted in a particular way, then you probably need to not use RowSource and populate the list like this. Private Sub UserForm_Activate() Dim c as Range ComboBox1.Clear For Each c In Sheets("Sheet1").Range("A1:A10") ComboBox1.AddItem Format(c, "mmmm yyyy") Next c End Sub Hth, Merjet |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date Format In Combobox
The issue is that although the dates are formatted (e.g. as January 2007) in
the cells of the RowSource, when they appear the Combo they are shown as their date value number. Having said that, your solution works (thank you!) but, like you, I had expected the formatting from RowSource to be duplicated in the control. Ian "merjet" wrote: It's not crystal clear to me what you mean. If the dates are formatted in the cells of the RowSource as January 2007, then they appear that way in the ComboBox when the entire list is shown. However, after selecting one, such format isn't shown for the selected value. So I guess that's what you mean. If you want the selected value formatted in a particular way, then you probably need to not use RowSource and populate the list like this. Private Sub UserForm_Activate() Dim c as Range ComboBox1.Clear For Each c In Sheets("Sheet1").Range("A1:A10") ComboBox1.AddItem Format(c, "mmmm yyyy") Next c End Sub Hth, Merjet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Format Date ComboBox | Excel Discussion (Misc queries) | |||
Combobox Date format change | Excel Programming | |||
Format date in combobox | Excel Programming | |||
Combobox/Rowsource - loses date/time format | Excel Programming | |||
ComboBox Date Format Problem | Excel Programming |