vba - 如何仅在 UserForm1 的 Page1 中计算 "Checkboxes"?

标签 vba excel checkbox userform

如何使用 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/

相关文章:

vba - protected 工作表中 protected 宏按钮

excel - 如果列为空则删除行

java - 对使用 Java 创建的 Excel 文件的访问权限

php - 如何根据行值 1、2、5、6 恢复选中和未选中的复选框

excel等待网页打开

vba - 在用户桌面上创建当前文件夹的快捷方式

excel - 我正在尝试使用来自事件表(VBA)的值创建数组

android - android中复选框的复选标记图像的间距

javascript - 选择标题复选框时选择所有复选框

vba - 展望 2013 VBA : store user defined settings