我如何计算"复选框"仅在带有VBA的UserForm1中的Page1中? 我在下面的所有内容都计入Page2和Page3。感谢。
Private Sub CommandButton1_Click()
Dim cnt As Integer
cnt = Count.CheckBox()
If Me.MultiPage1.Enabled = True Then
Dim ctrl As msforms.Control, cnt As Long
cnt = 0
For Each ctrl In UserForm1.Controls
If TypeOf ctrl Is msforms.CheckBox Then
cnt = cnt + 1
End If
Next
MsgBox cnt
End If
答案 0 :(得分:4)
你会在这里找到它们:
Me.MultiPage1.Pages(0).Controls
如果您只想要号码:
MsgBox Me.MultiPage1.Pages(0).Controls.Count
<强>更新强>
现在实际上计算复选框
For Each ctrl In Me.MultiPage1.Pages(0).Controls
If TypeOf ctrl Is msforms.CheckBox Then
cnt = cnt + 1
End If
Next