smma
Mechanical
- Jun 4, 2007
- 24
Hello! I have an Excel worksheet with 6 checkboxes on them. The first checkbox is supposed to check all checkboxes when it is clicked. I have the code below:
Private Sub Checkbox0_Click()
If CheckBox0.Value = True Then
Dim i As Integer
For i = 1 To 5
CheckBox(i).Value = True
Next i
End If
End Sub
However, on running it in VBA, it gives me a compile error saying "Sub or Function is not defined". What is the right syntax to loop each check box and make them all true?
Private Sub Checkbox0_Click()
If CheckBox0.Value = True Then
Dim i As Integer
For i = 1 To 5
CheckBox(i).Value = True
Next i
End If
End Sub
However, on running it in VBA, it gives me a compile error saying "Sub or Function is not defined". What is the right syntax to loop each check box and make them all true?