View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Evaluating formula in VBA

Sub eval()
Dim s As String
s = "=A1+A2"
MsgBox (Evaluate(s))
End Sub

--
Gary''s Student - gsnu200856


"Walter Briscoe" wrote:

I have a string variable containing a formula which I want to evaluate.
I can do what I want with
activeCell.FormulaLocal = fx
result = activeCell.Value

I want a function which evaluates result without writing to a cell.
i.e. I am looking for the name of a function which will do
result = name(fx) and return the value of fx.

fx might have a value like "=""prefix"" & A1 & ""suffix""".

I have failed to find such a function. ;(
--
Walter Briscoe