I have a button that generates ActiveX checkboxes based on a range of cells that the user selects. These checkboxes are linked to their corresponding cell. Additionally, a master checkbox is generated along with them that is intended to check/uncheck the rest of the checkboxes.
What I am trying to do is have an event occur when this master checkbox is checked and ends up checking the rest.
I was thinking of something like this which is the creation of my Master Checkbox:
Sub AddMasterCheckbox(cbNum As Integer, cbIdent As String, Rng As Range)
Dim name
With ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1", _
Left:=1033.5, Top:=Rng.Top, Width:=150.5, Height:=20.75)
If cbNum < 10 Then
.name = "NewCheckBox" & cbIdent & "0" & cbNum
Else
.name = "NewCheckBox" & cbIdent & cbNum
End If
name = .name
.Object.Caption = "Select all for this Machine"
.Object.OnAction = "'SelectAll ""name""'"
End With
End Sub
However, I am getting an error, stating that this is not supported. Essentially, I have another subprogram called SelectAll which ideally would be called when the master checkbox is clicked.
How can I go about to doing this?
Aucun commentaire:
Enregistrer un commentaire