N
Newbeetle
Hi I have a command checkbox, such when its checked, it clears and unables
two form option buttons as below,
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
ActiveSheet.OptionButtons("Option Button 149").Enabled = False
ActiveSheet.OptionButtons("Option Button 149").Value = xlunchecked
ActiveSheet.OptionButtons("Option Button 150").Enabled = False
ActiveSheet.OptionButtons("Option Button 150").Value = xlunchecked
Else
ActiveSheet.OptionButtons("Option Button 149").Enabled = True
ActiveSheet.OptionButtons("Option Button 150").Enabled = True
End if
End Sub
I have on another sheet a button that when pressed clears the above option
buttons and checkbox.
Private Sub clearsheet2_Click()
Sheets("sheet2").Unprotect password:=("password")
Worksheets("sheet2").OptionButtons.Value = xlOff
Worksheets("sheet2").CheckBox1.Value = xloff
Sheets("sheet2").Protect password:=("password")
End Sub.
When this runs checkbox1 shades out but the tick is still there, I then
changed the line;
Worksheets("sheet2").CheckBox1.Value = xloff
to
Worksheets("sheet2").CheckBox1.Value = false
When I run now I get an error after the else in the code at the top.
How can I amend this to stop the error and to have the checkbox unchecked?
two form option buttons as below,
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
ActiveSheet.OptionButtons("Option Button 149").Enabled = False
ActiveSheet.OptionButtons("Option Button 149").Value = xlunchecked
ActiveSheet.OptionButtons("Option Button 150").Enabled = False
ActiveSheet.OptionButtons("Option Button 150").Value = xlunchecked
Else
ActiveSheet.OptionButtons("Option Button 149").Enabled = True
ActiveSheet.OptionButtons("Option Button 150").Enabled = True
End if
End Sub
I have on another sheet a button that when pressed clears the above option
buttons and checkbox.
Private Sub clearsheet2_Click()
Sheets("sheet2").Unprotect password:=("password")
Worksheets("sheet2").OptionButtons.Value = xlOff
Worksheets("sheet2").CheckBox1.Value = xloff
Sheets("sheet2").Protect password:=("password")
End Sub.
When this runs checkbox1 shades out but the tick is still there, I then
changed the line;
Worksheets("sheet2").CheckBox1.Value = xloff
to
Worksheets("sheet2").CheckBox1.Value = false
When I run now I get an error after the else in the code at the top.
How can I amend this to stop the error and to have the checkbox unchecked?