View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Combobox default text

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?