Archive of Mr Excel Message Board

Back to Controls in Excel archive index
Back to archive home

check boxes
Posted by Laurie Updegrove on August 20, 2001 6:58 AM
I put check boxes in my spreadsheet and would like to know how to count them

Re: check boxes
Posted by Russell Hauf on August 20, 2001 8:26 AM
Try this:
Sub CountCheckBoxes()
Dim shp As Shape
Dim intI As Integer
For Each shp In ActiveSheet.Shapes
If shp.FormControlType = xlCheckBox Then
intI = intI + 1
End If
Next shp
Debug.Print intI ' This is your total # of checkboxes
End Sub
Hope this helps,
Russell

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.