解锁 Excel 中按单元名称 Office 2007 选择的单元格范围
我有 3 个单元格,它们相互合并并使用给定的单元格名称(例如“foo”)进行引用。
我现在想使用 locked
属性解锁这些单元格。
以下代码中的锁定将不起作用,但该值将成功分配给单元格:
Workbooks(loadedSheetName).Worksheets("foo").Range("bar").Locked = False
Workbooks(loadedSheetName).Worksheets("foo").Range("bar") = "foo value"
有效的是通过“坐标”引用单元格,但这对我来说并不是一个真正的选择:
Workbooks(loadedSheetName).Worksheets("foo").Range("B3:E3").Locked = False
有吗是否可以按名称选择一些合并单元格并将 locked
属性设置为 false?
I have 3 cells which are merged with each other and are referenced to with a given cellname (for example "foo").
I now want to unlock these cells with the locked
attribute.
The lock in the following code will not work, but the value will be successfully assigned to the cell:
Workbooks(loadedSheetName).Worksheets("foo").Range("bar").Locked = False
Workbooks(loadedSheetName).Worksheets("foo").Range("bar") = "foo value"
What will work is referencing the cells by "coordinates" but is not really an option for me:
Workbooks(loadedSheetName).Worksheets("foo").Range("B3:E3").Locked = False
Is there any possibility to select some merged cells by name and set the locked
attribute to false?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下代码在我的 Excel 2007
HTH 中运行正常!
The following code works OK in my Excel 2007
HTH!
您不需要遍历
Range
中的每个单元格。简单地...
You don't need to go through every cell in a
Range
.Simply...