Button Enabling based on check in checkbox

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

I have CheckBox1 and TextBox1 on a UserForm. The goal is
to only enable Textbox1 to be typed in only if checkbox1
has a check in it. I would like to achieve this by using
an IF THEN statement. All Responses are welcome.

Thank you in advance.

Todd Huttenstine
 
Todd chose:

Private Sub CheckBox1_Click()
If Checkbox1.Value = True Then
Textbox2.Enabled = True
Else
Textbox2.Enabled = False
End If
End Sub

in lieu of

Private Sub CheckBox1_Click()
Me.TextBox1.Enabled = CBool(Me.CheckBox1.Value)
End Sub
 
Hello Todd,

Give this a try:

Private Sub UserForm_Initialize()
'This will set the default value
Me.CheckBox1.Value = False
Me.TextBox1.Enabled = False
End Sub

Private Sub CheckBox1_Click()
If Me.CheckBox1.Value = True Then
Me.TextBox1.Enabled = True
Else
Me.TextBox1.Enabled = False
End If
End Sub

Regards,

Jon-jon
 
Back
Top