Private Sub CommandButton1_Click()
Dim iTot As Integer, iCount As Integer
Dim CTL As Control
Dim sText As String
For Each CTL In Me.Controls
If TypeName(CTL) = "CheckBox" Then
iTot = iTot + 1
If CTL.Value = True Then iCount = iCount + 1
End If
Next CTL
MsgBox iCount & " of " & iTot & " checked"
End Sub
Private Sub CommandButton1_Click()
Dim objCheckBx As Control
Dim iCountCB As Long
Dim iCountEnabledCB As Long
Dim iCBPercent As Double
For Each objCheckBx In Me.Controls
If TypeOf objCheckBx Is MSForms.CheckBox Then
iCountCB = iCountCB + 1
If objCheckBx = True Then iCountEnabledCB = iCountEnabledCB + 1
End If
Next
iCBPercent = Application.WorksheetFunction.Sum(iCountEnabledCB) / iCountCB
MsgBox Format(iCBPercent, "0%") & " of the Check Boxes Have Been Checked"
End Sub
Private Sub CommandButton1_Click()
Dim objCheckBx As Control
Dim iCountCB As Long
Dim iCountEnabledCB As Long
Dim iCBPercent As Double
Dim i As Integer
Dim strPageName As String
For i = 0 To MultiPage1.Pages.Count - 1
strPageName = MultiPage1.Pages(i).Name
For Each objCheckBx In MultiPage1.Pages(i).Controls
If TypeOf objCheckBx Is MSForms.CheckBox Then
iCountCB = iCountCB + 1
If objCheckBx = True Then iCountEnabledCB = iCountEnabledCB + 1
End If
Next
iCBPercent = Application.WorksheetFunction.Sum(iCountEnabledCB) / iCountCB
MsgBox Format(iCBPercent, "0%") & " of the Check Boxes on Page " & strPageName & " Have Been Checked"
Next
End Sub