+ Reply to Thread
Results 1 to 6 of 6

Summing checked checkboxes

  1. #1
    Registered User
    Join Date
    06-12-2014
    Posts
    7

    Summing checked checkboxes

    I have a sheet with 3 columns - each containing 15 checkboxes.

    I need to sum the qty of each of the checked boxes in each column.


    The resultant value for each column needs to be pushed to a cell for comparison. (Let's say R1C1 R1C2 R1C3)

    This has to be done in realtime - no running macros or pushing buttons, so I'm guessing some variant of OnChange event ...

    This is a simple piece of code that works, but only for the entire sheet, and only works on command.

    Sub Find_Checkbox_State()
    Dim CB As CheckBox
    Dim Checked_box As Integer

    Checked_box = 0
    For Each CB In ActiveSheet.CheckBoxes
    If CB.Value = 1 Then
    Checked_box = Checked_box + 1
    End If
    Next CB


    any takers?

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Summing checked checkboxes

    EDITORIAL NOTE: You dont really need to check for "IF CB.Value = 1" , just add them all...Checked_box = abs(CB.Value )

    SOLUTION:
    Instead of using activeX control checkboxes (that give no reference to column), use FORM CONTROL check boxs..the values go into cells.
    You dont have to scan each check box, Just look at the cell that sums the column. Its always LIVE!

  3. #3
    Registered User
    Join Date
    06-12-2014
    Posts
    7

    Re: Summing checked checkboxes

    I was actually trying to get away from filling cells up with data .. then you have to start hiding cells/rows/columns/sheets, then of course .. protecting.
    I was looking to streamline by making the code do the background stuff.

  4. #4
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Summing checked checkboxes

    Then you made it harder...you cant tell where the checkbox goes to what cell. I used 'outer' cells, like XAA.
    Form controls elimitate these headaches.

  5. #5
    Registered User
    Join Date
    06-12-2014
    Posts
    7

    Re: Summing checked checkboxes

    OK.
    Yes you are absolutely right. This will work.
    And ultimately that's what I want.

    I'm still looking for an alternate solution, however.

  6. #6
    Registered User
    Join Date
    06-12-2014
    Posts
    7

    Re: Summing checked checkboxes

    hmmm.
    Disappointing.
    I thought - given the name of this forum - that solutions suggested might have been in VBA format, as opposed to using native Excel functions.
    I was originally using native functionality, but wanting to reach a little higher.
    Onwards and outwards!
    Thanks for the attempt.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to copy only checked checkboxes into new cell?
    By GTX2013 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-06-2013, 09:06 PM
  2. [SOLVED] Combining SUMPRODUCT with Checked Checkboxes
    By pstewart in forum Excel General
    Replies: 6
    Last Post: 08-11-2012, 04:49 PM
  3. How to run a macro if checkboxes are checked in a range
    By franksonata in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-07-2012, 07:31 AM
  4. Checkboxes checked based on cell value
    By humboldtguy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-23-2010, 09:48 AM
  5. [SOLVED] My checkboxes will not stay checked.
    By NUMBnut in forum Excel General
    Replies: 0
    Last Post: 01-09-2006, 05:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1