(detailed edited picture enclosed)
The format date function works well when the combobox text (text at the top) and the value (linked cell) are referring to the same data and the datatype is date.
However, if i seperate them, so
- .TextColumn (text at the top) will be column 1 (string) and
- .BoundColumn will be column 2 (date)
then the format function throws an "Invalid property value" error. (no matter if I want to set the Value by formatting the text property, or want to set the value property by setting the text property, or setting text property by formatting text property)
I guess I don't really understand the "Text" and "value" property. I would just think one of them is the text on the top of combobox (text) and other is the linked cell value (value property).
But it seems to me that they are somehow not independent from each other. But I don't understand exactly why and how could I set the "Text" property to a formatted date from the data set and how to set linked cell to a completely other data type.
Thank you very much, I am really confused by this one.
The format date function works well when the combobox text (text at the top) and the value (linked cell) are referring to the same data and the datatype is date.
However, if i seperate them, so
- .TextColumn (text at the top) will be column 1 (string) and
- .BoundColumn will be column 2 (date)
then the format function throws an "Invalid property value" error. (no matter if I want to set the Value by formatting the text property, or want to set the value property by setting the text property, or setting text property by formatting text property)
I guess I don't really understand the "Text" and "value" property. I would just think one of them is the text on the top of combobox (text) and other is the linked cell value (value property).
But it seems to me that they are somehow not independent from each other. But I don't understand exactly why and how could I set the "Text" property to a formatted date from the data set and how to set linked cell to a completely other data type.
Thank you very much, I am really confused by this one.
VBA Code:
Private Sub ComboBox1_Change()
ComboBox1.Value = Format(ComboBox1.Text, "dd/mmm/yyyy") 'THIS line throws the error:/
End Sub
Sub test()
With MySheet.ComboBox1
.ListFillRange = "A1:B5"
.LinkedCell = Range("G8").Address
.ColumnCount = 2
.TextColumn = 1 'text showing as selected at the top
.BoundColumn = 2 'linked cell value
End With
End Sub
Last edited: