Eval in cell returning a reference?

211 views Asked by At

I'm trying to place values in cells using the Eval function:

           With wsCalculations
             .Cells(j, i + 1).Value = Eval(ary(1))
           End With

However, the thing is this is always returning "#REF!" values. Something I do not expect, as when I MsgBox (Eval(ary(1))) gives me a decimal value. I need to evaluate the value as otherwise I just see a string.

Here's the eval function i'm using:

        Function Eval(Ref As String)
         Application.Volatile
         Eval = Evaluate(Ref)
        End Function

What's missing here?

1

There are 1 answers

0
Daniels118 On

Evaluate actually returns a cell reference, you should explicitly get its value this way:

Eval = Evaluate(Ref).Value