excel - 使用不同的多个复选框写入同一个单元格
问题描述
我试图让不同的多个复选框写入同一个单元格而不覆盖以前的信息。
If CheckBox13.Value = True _
Then
Range("A1").Value = "True 1"
End If
If CheckBox14.Value = True _
Then
Range("A1").Value = Range ("A1").Value + "True 2"
End If
这看起来准确吗?
解决方案
利用控件的默认属性,您可以使用如下内容:
Range("A1") = ""
If CheckBox1 Then Range("A1") = "True 1"
If CheckBox2 Then Range("A1") = Range("A1") + ", True 2"
If CheckBox3 Then Range("A1") = Range("A1") + ", True 3"
If CheckBox4 Then Range("A1") = Range("A1") + ", True 4"
If (Range("A1") <> "") And (Left(Range("A1"), 1) = ",") Then
Range("A1") = Mid(Range("A1"), 3)
End If
推荐阅读
- android - Google AdMob 广告未在真实设备中显示,但在模拟器中运行
- python - 在 Pycharm 编辑器中,MySQL 命令“显示数据库”在运行后不返回结果或错误?
- python - 带有 GMT 值的 Django Pytz 时区全名
- python - scrapy-splash 给我这个错误“HTTP 状态代码未处理或不允许”
- css - React Material UI – 使用 UI Grid 将屏幕一分为二,一半可滚动,另一半固定
- sql - 使用 2 组,是否可以将第 2 组拆分为列?
- deep-learning - 为什么当有 5GB 可用内存时 pytorch(CUDA) 无法分配 290MB
- sql-server - 无法访问 Azure SQL Server - 登录失败
- python - 如何从 Python 中的字典列表中更改特定值
- for-loop - roblox 中的“限制必须是数字”错误(数据保存和加载)