Results 1 to 4 of 4

How to Count Check Boxes and count the total number of boxes checked

Threaded View

  1. #1
    Registered User
    Join Date
    07-09-2013
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    2

    How to Count Check Boxes and count the total number of boxes checked

    My goal is to count the number of Check Boxes on each worksheet and the total number of checked checkboxes on each worksheet.
    I am probably making this too complicated and can use the help.

    Thanks


    Sub Checkedboxes()
    
        Dim sCtrl  As Shape
        Dim lCount As Long
        Dim checked As Long
        Dim myshape As Shape
        Dim boxes As Long
        
    
        
        For Each sCtrl In Sheet1.Shapes
            If sCtrl.Type = msoFormControl Then
                If sCtrl.FormControlType = xlCheckBox Then
                    If sCtrl.TopLeftCell = vbNullString Then
                       lCount = lCount + 1
                       
                    If myshape.ControlFormat.Value = xlOn Then
                    boxes = boxes + 1
                    
                    End If
                    
                        
                    End If
                     
                End If
            End If
        Next sCtrl
    
        ThisWorkbook.Sheets("Sheet1").Cells(18, 3) = lCount
        
        ThisWorkbook.Sheets("Sheet1").Cells(20, 3) = boxes
        
    End Sub
    Last edited by t04904; 07-12-2013 at 11:53 AM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

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