Disable other combobox and buttons until selection made

LNG2013

Active Member
Joined
May 23, 2011
Messages
466
What would be the VBA code to set buttons and the other comboboxes in my userform as disabled until a selection is made from ComboBox1.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Well it's a combobox1_change event right?
So, if the combobox1 is in your userform, it probably is a userform module.

To find other events you could use, you will see 2 drop down boxes near the top that are side by side and long.
If you click the left drop down box, it will show you all the lists of objects in the module.
and If you click the right drop down box, it will show you all the corresponding events for the selected object in the left drop down box.

So, you want to go to your userform moduel
click the left drop down box
click combobox1
click the right drop down box
click change

then you will see some kind of this code displayed in your editor automatically
Code:
Private Sub combobox1_change()
 
End Sub

That's where you will need to write your code in.

If you aren't sure what I mean by change event, let me know.
 
Upvote 0
Put a loop like this in the Initalize event.

Code:
Dim oneControl as Object

For Each oneControl In Me.Controls
    oneControl.Enabled = False
Next oneControl
ComboBox1.Enabled = True

And this in the ComboBox1_Change event
Code:
Dim oneControl as Object

For Each oneControl In Me.Controls
    oneControl.Enabled = (-1 < ComboBox1.ListIndex)
Next oneControl
 
Upvote 0

Forum statistics

Threads
1,224,608
Messages
6,179,872
Members
452,949
Latest member
Dupuhini

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