Search code examples
excelvbamacosevaluateexcel-2011

Mac Excel 2011 VBA Evaluate


I am moving a excel VBA from PC to Mac and one line has an Evaluate function, for example:

Public Function test()

    test = Evaluate("=2+2")

End Function

However, if I try and run the macro on the mac the function returns #name. Is there an equivalent function on the Mac side to Evaluate?


Solution

  • There is nothing wrong with the above function.

    If you are calling the above function in VBA then it works as expected and If you are using it as a UDF i.e you are calling it from the worksheet then #Name error means that you have not pasted the function in a module. Move the function from the Sheet/Workbook code area into a module and then try again.

    enter image description here