How to break this shape reference code in 2 lines?

…衆ロ難τιáo~ 提交于 2020-01-05 04:21:31

问题


This code works fine, but i have my sheet BLOCKED for selections.

Sheets("sheet1").Shapes("test_" & i).Select
Selection.Formula = ""

...and i want to to this:

Sheets("sheet1").Shapes("test_" & i).Formula = ""

But i got the object error to not accept this prop or method.

What am i missing?


回答1:


Formula is a property of the DrawingObject property:

Sheets("sheet1").Shapes("test_" & i).DrawingObject.Formula = ""

For an activeX textbox (assuming you want to change the LinkedCell property):

Dim tb
Set tb = ActiveSheet.Shapes("test_" & i)
tb.OLEFormat.Object.LinkedCell = ""


来源:https://stackoverflow.com/questions/58382527/how-to-break-this-shape-reference-code-in-2-lines

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!