Hi
I want to check if a group of ActiveX-style checkboxes "named" Checkbox1 - Checkbox24 consecutively are checked and then add or minus 1 in a cell
I'd really like to do this on worksheet_change so each time a checkbox is checked/unchecked it will update
However the code I have is currently linked to a button
It doesn't work however,
"Runtime error 1004 Unable to get the OLEobjects property of the Worksheet Class"
I could of course repeat the above code for each "click" event, which would work but is very messy if I want to, for example change the cell I am adding or deleting a value from?
I want to check if a group of ActiveX-style checkboxes "named" Checkbox1 - Checkbox24 consecutively are checked and then add or minus 1 in a cell
I'd really like to do this on worksheet_change so each time a checkbox is checked/unchecked it will update
However the code I have is currently linked to a button
Code:
Sub AddBoxes()
Dim k As Integer
For k = 1 To 24
If ActiveSheet.OLEObjects("Checkbox" & k).Object.Value = 0 Then
Range("A1").Value = Range("A1").Value - 1
End If
If ActiveSheet.OLEObjects("Checkbox" & k).Object.Value = 1 Then
Range("A1").Value = Range("A1").Value + 1
End If
Next
End Sub
It doesn't work however,
"Runtime error 1004 Unable to get the OLEobjects property of the Worksheet Class"
I could of course repeat the above code for each "click" event, which would work but is very messy if I want to, for example change the cell I am adding or deleting a value from?