ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   counting checkboxes (https://www.excelbanter.com/excel-programming/406634-counting-checkboxes.html)

Manny

counting checkboxes
 
Is it possible to count up the "true" values of a series of checkboxes? If
so, what is the formula?
--
Thanks,
Manny

Jim Thomlinson

counting checkboxes
 
The easiest way is to link the checkbox's to cells in your sheets. If the
checkboxes come from the control toolbox then add a reference to the
LinkedCell property (put the sheet in design mode and right click the
checkbox and select Properties). If the check boxes are from the forms
toolbar then right click the check box and select Format control | control.

Once you have linked each checkbox to a cell you can do a simple countif
function to get the number of checks...
--
HTH...

Jim Thomlinson


"Manny" wrote:

Is it possible to count up the "true" values of a series of checkboxes? If
so, what is the formula?
--
Thanks,
Manny


Rick Rothstein \(MVP - VB\)[_1335_]

counting checkboxes
 
If you name your CheckBox'es so that they start with the same text
("CheckBox" for this example) and end in numbers of the same length (that
is, use leading zeroes if there are more than 9 CheckBox'es; that is, the
first 9 names should end with 01, 02, 03, etc. instead of just 1, 2, 3,
etc.), then this code will count the number of with check marks in them...

Dim X As Long
Dim Count As Long
Dim C As Control
For Each C In Me.Controls
If C.Name Like "CheckBox##" Then
If C.Value = True Then Count = Count + 1
End If
Next

Rick


"Manny" wrote in message
...
Is it possible to count up the "true" values of a series of checkboxes? If
so, what is the formula?
--
Thanks,
Manny



JLGWhiz

counting checkboxes
 
If the checkboxes were from the ControlToolbox and are on the Worksheet:

Sub chbx()
For i = 1 To 5
If Sheets(1).Shapes(i).Name = "CheckBox" & i Then
If Sheets(1).OLEObjects("CheckBox" & i).Object _
.Value = True Then
x = x + 1
End If
End If
Next
MsgBox x
End Sub

Somebody has already posted the code for other conditions..

"Manny" wrote:

Is it possible to count up the "true" values of a series of checkboxes? If
so, what is the formula?
--
Thanks,
Manny


Manny

counting checkboxes
 
I just wanted to say thanks to everyone for your help!!! It is surely
appreciated.

Manny


All times are GMT +1. The time now is 06:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com