ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Button Enabling based on check in checkbox (https://www.excelbanter.com/excel-programming/283510-button-enabling-based-check-checkbox.html)

Todd Huttenstine[_2_]

Button Enabling based on check in checkbox
 
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

Tom Ogilvy

Button Enabling based on check in checkbox
 
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

--
Regards,
Tom Ogilvy



Todd Huttenstine wrote in message
...
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




JON JON

Button Enabling based on check in checkbox
 
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

"Todd Huttenstine" wrote in message
...
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





All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com