excel - vba中如何判断单选框是否被选中
问题描述
VBA中如何判断单选框是否被选中?表单控件,</p>
Set sht = ThisWorkbook.Sheets(1)
If sht.OptionButton1.Value = 1 Then
MsgBox "ok!"
End If
不运行
解决方案
例子
Option Explicit
Public Sub Example()
If ThisWorkbook.Sheets(1).OptionButtons("Option Button 1").Value > 0 Then
MsgBox "Yes"
Else
MsgBox "No"
End If
End Sub
推荐阅读
- java - 在 Null 对象上调用虚拟方法
- react-native - 从浏览器单击链接时,如何打开 React Native 应用程序的特定屏幕?
- sql-server - SQL Server:如何将 [yyyy-MM-ddTHH:mm] 的自定义日期时间字符串转换为日期时间?
- python - Python webbrowser.open() 在 VScode 中不起作用(已经尝试了两个环境)
- c++ - 通过 cin 验证
- python - 由于未知错误导致页面崩溃,Python Selenium 会话被删除:无法从选项卡崩溃中确定加载状态
- blazor-webassembly - Blazor wasm 错误“对象引用未设置为对象的实例”没有意义
- tensorflow - 如何参数化 TensorFlow 分布?
- python - R 中的 Python 降价
- javascript - 如何通过空值在mongodb中找到记录