如何使用 VBA 仅在 UserForm1 的 Page1 中计算“复选框”?
下面我的全部在第 2 页和第 3 页中。谢谢。
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
最佳答案
你会在这里找到它们:
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
关于vba - 如何仅在 UserForm1 的 Page1 中计算 "Checkboxes"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50612032/