i have 5 check boxes in my sheet (check box 1, 2, 3,....)
i need if "check box 1" is checked then "check box 2, 3, and 4" goes to disable and false
i have 5 check boxes in my sheet (check box 1, 2, 3,....)
i need if "check box 1" is checked then "check box 2, 3, and 4" goes to disable and false
Last edited by usman5594; 07-18-2013 at 01:07 PM.
Welcome to the forum!
Are these form or activex controls? You can attach a short example if needed.
these check boxes from FORM CONTROLSOriginally Posted by Kenneth Hobs
You could attach this macro to Check Box 1
[VBA]Sub test()
Dim i As Long
For i = 2 To 4
With Sheet1.Shapes("Check Box " & i).ControlFormat
.Value = xlOff
.Enabled = Not (Sheet1.Shapes("Check Box 1").ControlFormat.Value = xlOn)
End With
Next i
End Sub[/VBA]
this code work profectly,Originally Posted by mikerickson
thank you very much mikerickson this macro work perfectly with 2 to 4
can you make it for multimap check boxes without series i mean for checkbox 2,3,and 5
Last edited by usman5594; 07-18-2013 at 12:17 PM.
Just call test from the macro. You can put test into that sheet's code or a Module. Or, paste the code from test into your macro.
[vba]Sub CheckBox1_Click()
test
End Sub[/vba]
or
[VBA]
Sub CheckBox1_Click()
Dim i As Long
For i = 2 To 4
With Sheet1.Shapes("Check Box " & i).ControlFormat
.Value = xlOff
.Enabled = Not (Sheet1.Shapes("Check Box 1").ControlFormat.Value = xlOn)
End With
Next i
End Sub[/VBA]
this macro work perfectly with checkbox 2 to 4Originally Posted by Kenneth Hobs
can you make it for multimap check boxes without series i mean for checkbox 2,3,and 5
[VBA]Sub CheckBox1_Click()
Dim a() As Variant, v As Variant
a() = Array(2, 3, 5)
For Each v In a()
With Sheet1.Shapes("Check Box " & v).ControlFormat
If Sheet1.Shapes("Check Box 1").ControlFormat.Value = xlOn Then
.Value = xlOff
.Enabled = False
Else: .Enabled = True
End If
End With
Next v
End Sub[/VBA]
Kenneth Hobs Grate JobOriginally Posted by Kenneth Hobs
Thank You Very Much For My Help
My problem is solved