Activate and deactivate the text box with option button in Excel

mmn1000

Board Regular
Joined
Mar 17, 2020
Messages
76
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Hi;
How can I enable and disable multiple text boxes using the combo box option button?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
That would mean what, I choose list item 1 in the combo and textboxes 2 and 3 are disabled? Choose combo list item 2 and other textboxes are disabled? And those that were disabled no longer should be when another option is chosen? Or they remain disabled?

To answer simply and based on my interpretation of your question, you would use the AfterUpdate event of the combo and act according to what you want. However, I don't know what a combobox "option button" is. There are also controls called option buttons but I suspect those are not involved here.
 
Upvote 0
Let me pose my question like this.

I have 6 ComboBox and 2 OptionButton in my UserForm
How can I disable some ComboBoxs by selecting OptionButton 1 so that nothing can be written in it?
When I select OptionButton2, all ComboBoxs are active and editable for me
 

Attachments

  • Untitled.png
    Untitled.png
    7.1 KB · Views: 6
Upvote 0
Here's one way but this is off the top of my head, thus is untested:

open form in design view, put a value in the Tag property for each of those combos. Could be anything; let's use "LockMe" without the quotes. Then
create option button AfterUpdate events for both buttons. Put this line for enable button:
EnableCombos True

and for disable button put
EnableCombos False

Then create a sub (also in the userform)
VBA Code:
Private Sub EnableCombos(bolState As Boolean)
Dim ctl As control

For Each ctl In Me.Controls
     If TypeName(ctl) = "ComboBox" And ctl.Tag = "LockMe" Then
         ctl.Enabled = bolState
    End If
Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,110
Messages
6,123,147
Members
449,098
Latest member
Doanvanhieu

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