Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel Eval within Eval

Tags:

excel

vba

eval

I'm using custom eval function in VBA. However, evaluating a formula which contains another eval() fails:

=Eval(I21)

Cell I21: (formula itself works) Note: INDIRECT() doesnt work too

'=MATCH("SOME TEXT",eval($I$22),0)

Cell I22: (location reference)

''1516Activity'!$C:$C

VBA:

Function Eval(Ref As String)
    Application.Volatile
    Eval = Application.ThisCell.Parent.Evaluate(Ref)
End Function
like image 268
zhuhang.jasper Avatar asked Apr 07 '26 06:04

zhuhang.jasper


1 Answers

VBA:

Eval = Application.Evaluate(Ref) 

This solution only works when cell-reference uses fully qualified range addresses. If your reference depends on caller ( involves row()+- and column()+- ), then you are in the same situation as me, no solution.

like image 149
zhuhang.jasper Avatar answered Apr 09 '26 21:04

zhuhang.jasper



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!