Home » excel » vba – excel udf being called too many times

vba – excel udf being called too many times

Posted by: admin April 23, 2020 Leave a comment

Questions:

I have a excel function defined in a module which is called a total of two times as a worksheet functon. However when I do a shift+f9 and place a breakpoint on the function, i noticed that its getting called more than twice, around 5 times. This function however is not being called anywhere else, both programmatically or in any worksheet except for the two cells i mentioned above.

Furthermore, when I look at the call stack when execution hits my function, it shows just my function being the top level call. Any help regarding what may be causing this? Thanks.

How to&Answers:

There are many possible reasons for this but probably the most likely is the UDF being called with uncalculated cells:
see http://www.decisionmodels.com/calcsecretsj.htm for details