PC Review


Reply
Thread Tools Rate Thread

counting checkboxes

 
 
Manny
Guest
Posts: n/a
 
      25th Feb 2008
Is it possible to count up the "true" values of a series of checkboxes? If
so, what is the formula?
--
Thanks,
Manny
 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      25th Feb 2008
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

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      25th Feb 2008
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" <(E-Mail Removed)> wrote in message
news:1B7FDDB6-6FE6-464C-9985-(E-Mail Removed)...
> Is it possible to count up the "true" values of a series of checkboxes? If
> so, what is the formula?
> --
> Thanks,
> Manny


 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      25th Feb 2008
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

 
Reply With Quote
 
Manny
Guest
Posts: n/a
 
      25th Feb 2008
I just wanted to say thanks to everyone for your help!!! It is surely
appreciated.

Manny
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting Checkboxes. =?Utf-8?B?V2lsbA==?= Microsoft Access Form Coding 1 28th May 2004 02:50 PM
Counting Checkboxes =?Utf-8?B?U3RldmVu?= Microsoft Excel Programming 5 17th May 2004 09:42 PM
Counting Checkboxes Jeff Hadley Microsoft Excel Misc 1 6th Feb 2004 03:18 PM
counting checkboxes icestationzbra Microsoft Excel Misc 5 27th Jan 2004 05:42 PM
Re: Counting checkboxes John Vinson Microsoft Access Queries 0 18th Sep 2003 05:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:07 PM.