vba - 如何仅在 UserForm1 的 Page1 中计算“复选框”?
问题描述
如何使用 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
推荐阅读
- mysql - 错误 1045 (28000):拒绝用户 '=root'@'localhost' 的访问(使用密码:否)
- android - 位置管理器总是返回 false 启用 gps 签入 android 中的 oreo+ 设备
- reactjs - 如何在 tomcat 服务器上部署 reactJS 应用程序?
- javascript - 我如何知道我的本地 IP 在 nodejs 中是否处于活动状态?
- javascript - 找不到类“NunoMaduro\Collision\Adapters\Laravel\CollisionServiceProvider”
- c++ - 如何在下一个函数调用中从最后一个位置使用 STL 映射擦除?
- stackdriver - StackDriver 自定义指标资源类型 cloud_composer_environment
- internet-explorer - 下载文件 - 使用 TestCafe 在 Internet Explorer 中保存弹出窗口
- c# - input 输入的数据无法在图表上显示
- html - 如何使用css将div的内容与底部对齐?