-
Enable/Disable TextBox based on Option Selection
I have a UserForm with 3 option buttons. Below the option buttons I have a text box that is only necessary when the third option button is selected. I need to know how to make the text box dimmed and disabled unless the third option button is selected. The third option button is called "optpriority3" and the text box is called "txtcomptime". Any help would be greatly appreciated.
-
[vba]Private Sub optPriority3_Click()
txtCompTime.Enabled = True
End Sub
Private Sub UserForm_Initialize()
txtCompTime.Enabled = False
End Sub
[/vba] In each of the other option button Click events, you'll need to add
[vba]txtCompTime.Text = ""
txtCompTime.Enabled = False[/vba]to clear out the field if they change their mind and select another option button.
-
-
Me, I would make the textbox either visible and enabled, or not visible. demo attached. Click "Show Me" on the top toolbar. Depending on whether Priority 3 is true, or not, the userform dimensions change, thus making the textbox either visible, or not. The commandbutton just does an Unload Me.
-
Me, I would make the textbox either visible and enabled, or not visible. demo attached. Click "Show Me" on the top toolbar. Depending on whether Priority 3 is true, or not, the userform dimensions change, thus making the textbox either visible, or not. The commandbutton just does an Unload Me.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules