vba 计算数组公式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27590768/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Evaluate an Array Formula
提问by Gary's Student
I can evaluate a normal Excel formula within VBAlike:
我可以在VBA 中评估一个普通的 Excel 公式,例如:
Sub dural()
MsgBox Evaluate("SUM(A1:A10)")
End Sub
How can I evaluate an array formula??
如何评估数组公式?
回答by Rusan Kax
As suggested by L42, you only have to use the string variant of Evaluate
to get it to work with array formulas.
For instance, does
正如L42所建议的,您只需要使用 of 的字符串变体Evaluate
即可使其与数组公式一起使用。
例如,是否
Sub dural()
MsgBox Evaluate("SUM(A1:A10)")
MsgBox Evaluate("=SUM(G5:G10-F5:F10)")
MsgBox [=SUM(G5:G10-F5:F10)]
MsgBox [Sum(G5:G10-F5:F10)]
End Sub
work for you (with appropriate values in G5:G10
and F5:F10
)?
Some further information is here.
为您工作(在G5:G10
和 中具有适当的值F5:F10
)?
一些进一步的信息是here。