excel - 运行时错误“1004”无法设置 Range 类的 NumberFormat 属性
问题描述
我安装了一个非常简单的命令按钮来为选定的单元格添加时间戳。命令按钮完全可以正常工作,直到我保护工作表,然后它会抛出标题中提到的错误。我已经检查过单元格的格式没有选择为“锁定”。
Private Sub CommandButton1_Click()
Dim ts As Date
With Selection
.Value = Now
.NumberFormat = "h:mm AM/PM"
End With
End Sub
解决方案
推荐阅读
- javascript - RXJS 的 Subject inside Function
- python - 解压缩 .gz 文件以创建新行分隔的 json 文件 - 创建新行时出现问题
- python - 从 keras fit_generator() 到模型输入层的转换如何准确工作
- java - 终止线程似乎不起作用
- python - 通过服务帐户连接的 Python googleads 库。错误:AttributeError:“str”对象没有属性“CreateHttpHeader”
- c - 在嵌入式系统中使用 c 中的可变长度数组有问题吗?
- xcode - 如何获取多窗口 SceneDelegate Xcode 11 的当前键窗口等效项?
- ios - 在 ios 中接收没有通知警报的 Firebase 云消息传递
- grafana - 访问目标仪表板中的单元格链接值
- sql - 错误:语法错误:应为“)”,但在子查询中得到语句结束语句