Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When the text property of a combobox is filled with for instance "Select an
Item", this is what displays when the form is opened. After a selection is made from the drop-down, the selected item is displayed in the combobox. Is there a way to clear the selection and reset the comobox display to the default "Select an Item" after a selection has been made? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you immediately negate the users' selection they will not be able to see
what they picked. It would be better to reset the combo after they do something else, like click a "commit" button. You'd use code like ComboBox1.ListIndex = 0 to do that. -- Jim "joeeng" wrote in message ... | When the text property of a combobox is filled with for instance "Select an | Item", this is what displays when the form is opened. After a selection is | made from the drop-down, the selected item is displayed in the combobox. Is | there a way to clear the selection and reset the comobox display to the | default "Select an Item" after a selection has been made? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "joeeng" wrote: When the text property of a combobox is filled with for instance "Select an Item", this is what displays when the form is opened. After a selection is made from the drop-down, the selected item is displayed in the combobox. Is there a way to clear the selection and reset the comobox display to the default "Select an Item" after a selection has been made? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can add to the code you currently use in the Click or Change event that
does something with the user's selection as illustrated below. I used the Change event but it will work in any of the event codes. Private Sub ComboBox1_Change() 'Put code to execute on user selection here chg = MsgBox("Click OK to reset ComboBox") If chg = vbOK Then ComboBox1.ListIndex = 0 End If End Sub The message box forces the user to click the OK button to reset the combo box, since the only options on this type message box is OK or the big X close icon. To be safe you could even include the X in the If statement: If chg = vbOK Or chg = 1 Then ComboBox1.ListIndex = 0 End If The "1" is the value clicking the big X close. "joeeng" wrote: When the text property of a combobox is filled with for instance "Select an Item", this is what displays when the form is opened. After a selection is made from the drop-down, the selected item is displayed in the combobox. Is there a way to clear the selection and reset the comobox display to the default "Select an Item" after a selection has been made? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Default font for pasted text in text boxes - Excel 2007 | Excel Discussion (Misc queries) | |||
combobox - default value | Excel Programming | |||
from VBA open text file in default text editor application | Excel Programming | |||
Setting Default of Checkbox based on value of combobox | Excel Programming | |||
ComboBox Default items Not Showing | Excel Programming |