Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Combobox default text

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Combobox default text

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combobox default text



"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   Report Post  
Posted to microsoft.public.excel.programming
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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default font for pasted text in text boxes - Excel 2007 MS OFFICE USER EIT Excel Discussion (Misc queries) 0 March 25th 10 09:01 PM
combobox - default value Jim at Eagle Excel Programming 2 June 20th 07 04:27 AM
from VBA open text file in default text editor application [email protected] Excel Programming 2 November 18th 05 07:17 PM
Setting Default of Checkbox based on value of combobox Lost![_5_] Excel Programming 1 June 9th 05 07:35 PM
ComboBox Default items Not Showing Shauna Koppang Excel Programming 2 August 21st 03 03:35 AM


All times are GMT +1. The time now is 10:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"