Gary's Student
Gary's Student

Reputation: 96773

Evaluate an Array Formula

I can evaluate a normal Excel formula within VBA like:

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

How can I evaluate an array formula??

Upvotes: 5

Views: 7871

Answers (1)

Rusan Kax
Rusan Kax

Reputation: 1894

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.

Upvotes: 7

Related Questions