Вам нужна функция Evaluate ():
Sub CalcFunc()
Dim func As String, xValue, yValue, newFunc As String
Const DEFAULT_FUNC = "x^2+2*y^2+4"
func = "=" & InputBox("Enter function:", , DEFAULT_FUNC)
xValue = InputBox("XValue:")
yValue = InputBox("YValue:")
newFunc = Replace(Replace(func, "x", xValue), "y", yValue)
MsgBox "Function: " & func & vbCrLf & "X: " & xValue & vbCrLf & "Y: " & yValue & vbCrLf & "Answer: " & Application.Evaluate(newFunc)
End Sub