Stop VBA Evaluate from calling target function twice

后端 未结 6 871
自闭症患者
自闭症患者 2020-12-06 06:45

I am having trouble getting VBA\'s Evaluate() function to only execute once; it seems to always run twice. For instance, consider the trivial example below. If we run the Ru

6条回答
  •  暖寄归人
    2020-12-06 07:41

    This bug only seems to happen with UDFs, not with built-in functions. You can bypass it by adding an expression:

    Sub RunEval()
        ActiveSheet.Evaluate "0+EvalTest()"
    End Sub
    

    But there are also a number of other limitations with Evaluate, documented here http://www.decisionmodels.com/calcsecretsh.htm

提交回复
热议问题