ComboBoxes

Scarlet

New Member
Joined
Jan 10, 2005
Messages
7
Hi,

I am trying to set comboBoxes on the userform. I have a clear button which sets the form to default (blank).

eg: Private Sub CmdClearButton_Click()
Call UserForm_Initialize
End Sub

It calls up the intialise command which I used to preset the form

eg: Private Sub UserForm_Initialize()

ComboBox1.Value = ""
ComboBox2.Value = ""
ComboBox3.Value = ""
ComboBox4.Value = ""
ComboBox5.Value = ""
ComboBox6.Value = ""
ComboBox7.Value = ""
ComboBox8.Value = ""

I have used the following command to fill the combo boxes

eg: Private Sub ComboBox1_Enter()
With UserForm1
With .ComboBox1
.AddItem "Format" 'these lines populate the listbox
.AddItem "Functuality"
.AddItem "Performance"
.AddItem "Capacity"
.AddItem "Availability"
.AddItem "Reliability"
.AddItem "Security"
.AddItem "Other"
End With
End With
End Sub

The problem I now have is that the information will not feed into my control source so I cannot save the information. Is the Enter command the wrong one to use? Maybe it is only entering the information, and there is no way of selecting it then.

I would appreciate any help with this!

Thanks, Scarlet
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I would avoid using the ControlSource property. Rather, update the cell in code:

Code:
Private Sub ComboBox1_Change()
    Range("A1").Value = ComboBox1.Value
End Sub

That said, you will need to be careful when clearing the ComboBox because that will cause the Change event to fire. When you clear it what do you want to happen?
 
Upvote 0
Andrew,

I want there to be a reset button on the form so that if the user wants to enter new information they can do so on a blank form. Do you think this is a workable idea?

Thanks, Scarlet

PS; I'll try using the code you gave me instead of the control Source. Tks.
 
Upvote 0

Forum statistics

Threads
1,207,011
Messages
6,076,145
Members
446,187
Latest member
LMill

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top