Using a checkbox to activate/deactivate input option
add code like this to the form
Private Sub CheckBox1_Click()
With Me
If .CheckBox1.Value = True Then
.TextBox1.Enabled = True
.TextBox1.BackColor = &HFFFFFF
.TextBox1.Enabled = True
.TextBox2.BackColor = &HFFFFFF
End If
End With
End Sub
Private Sub UserForm_Initialize()
With Me
.CheckBox1.Value = False
.TextBox1.Enabled = False
.TextBox1.BackColor = &HC0C0C0
.TextBox2.Enabled = False
.TextBox2.BackColor = &HC0C0C0
End With
End Sub
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Jacob" wrote in message
oups.com...
I have created a program using VBA and I am attempting to use a form
for my first time. I want to have a checkbox that when checked allows
users to input additional items into the form. by default I want the
box to be unchecked and those input boxes grayed out and disabled.
what is the best way to do this? thanks.
|