Activate and deactivate the text box with option button in Excel

mmn1000

Board Regular
Joined
Mar 17, 2020
Messages
80
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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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: 11
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,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

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