Evaluate an Array Formula

后端 未结 1 541
心在旅途
心在旅途 2020-12-18 05:49

I can evaluate a normal Excel formula within VBA like:

Sub dural()
    MsgBox Evaluate(\"SUM(A1:A10)\")
End Sub

How can I

相关标签:
1条回答
  • 2020-12-18 06:32

    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

    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.

    0 讨论(0)
提交回复
热议问题