简体   繁体   English

Excel vba更改形状公式而不选择形状

[英]Excel vba Change shape formula without selecting shape

I'm trying to change the formula within a shape without selecting it but keep getting a run-time error. 我试图在不选择它的情况下更改形状中的公式,但不断收到运行时错误。

Below are some of the code I've tried so far: 下面是我到目前为止尝试过的一些代码:

    Sheets("Quote").Shapes.Range(Array("Rectangle 87")).Formula = " =CommAnnualOutput"
    Sheets("Quote").Shapes("Rectangle 87").Formula = " =CommAnnualOutput"
    Sheets("Quote").Shapes("Rectangle 87").DrawingObjects.Formula = " =CommAnnualOutput"

None of these seem to work. 这些似乎都不起作用。 Is there a way to change the formula without selecting the shape first? 有没有办法在不首先选择形状的情况下更改公式?

Please find the answer to your question here: 请在此处找到您问题的答案:

Link cell with Excel Shape 使用Excel Shape链接单元格

Good luck 祝好运

You missed two characters on your last try. 你上次尝试时错过了两个角色。 That would be 那就是

Sheets("Quote").Shapes("Rectangle 87").DrawingObject.Formula = "=CommAnnualOutput"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM