E
Evaluate function parameter as VBA code
Dear all
I want to implementate a feature like this :
User type a formula in a cells : =MyFun(a, b, c, "Log(a+b/c"))
a, b, c are named cells, which are of double type.
the VBA code :
Function MyFun(a as double, b as double, c as double, S as string) as double
MyFun = Log(a+b/c) ' I want to to get this result, just like evaluate
the string S as VBA source code. It the S is changed by user in the formula
of the cell, the function can return the correct value.
' Tt's complex since equation parsing is
needed to implemente this feature, I just don't know there is a simple method
of not
End Function
Any help or clus is appreciated.
Thanks a lot~~
I want to implementate a feature like this :
User type a formula in a cells : =MyFun(a, b, c, "Log(a+b/c"))
a, b, c are named cells, which are of double type.
the VBA code :
Function MyFun(a as double, b as double, c as double, S as string) as double
MyFun = Log(a+b/c) ' I want to to get this result, just like evaluate
the string S as VBA source code. It the S is changed by user in the formula
of the cell, the function can return the correct value.
' Tt's complex since equation parsing is
needed to implemente this feature, I just don't know there is a simple method
of not
End Function
Any help or clus is appreciated.
Thanks a lot~~