the other problem you are going to run into as written is that the "range("a1") object is unqualified, so it will always reference the active sheet. So if you have two tabs in a sheet or have multiple workbooks open, it will pull the wrong information when those other sheets are active.
Better than an unqualified object and application.volatile is to pass the necessary information to the function through the argument list:
Function aa(varx As Variant,express as string) As Double 'varx is input as 3
x = varx
y = Evaluate(WorksheetFunction.Substitute(express, "x", x)) 'should return 5
aa = y
End Function
Bookmarks