This macro will visit each worksheet and put the count you want for that
worksheet in M10 for any worksheets that have CheckBoxes on them...
Sub CountButtons()
Dim CB As OLEObject, WS As Worksheet, Total As Variant, Found As Boolean
For Each WS In Worksheets
Total = 0
Found = False
For Each CB In WS.OLEObjects
If CB.progID Like "*CheckBox*" Then
Found = True
If InStr(1, CB.Name, "checkbox", vbTextCompare) Then
If Right(CB.Name, 1) <= 5 Then
If CB.Object.Value Then Total = Total + 1
End If
End If
End If
Next
If Found Then WS.Range("M10").Value = Total
Next
End Sub
--
Rick (MVP - Excel)
"jtfalk" <(E-Mail Removed)> wrote in message
news:EECE855D-DF29-40BA-BC61-(E-Mail Removed)...
> Good day,
>
> I have a sheet with multiple check boxes. I would like checkbox1-checkbox5
> to sum in cell M10.
>
> For example if checkbox2 and checkbox4 are checked then the value in cell
> M10 = 2
>
> Also I am going to be copying this worksheet over and over so it hase to
> be
> worksheet specific.
>
> Any help would be appreciated
|