stop automatic recalulation when error occurs

D

DagL

In a worksheet I have several user written functions. Several cells are using
this functions. If something is wrong, I get the same error message a number
of times. I want to suppress this, or stopp the recalculation from VBA
programming when the first error occurs.

My first alternative would be to suppress the message. But to do this, I
need to set a global flag that tells the program later that the error message
is shown. But when do I reset the flag from the beginning of the
recalculation?

To stopp the recalculation of the coming cells that need to bee recalculated
using the same function, I need to stop recalculating over all. How can this
be done?

In my excel worksheet, it seems that all my user written functions are
recalculated, even when the criteria of some of them is not changed. Can I do
somethinge to only recalulate those user written functions in cells where
criterias are affected by changes?

Regards DagL
 
C

Charles Williams

Hi Dag,

Sounds like you have a Msgbox inside the UDF? If so I would suggest you make
the function return a variant containing an error error (CVERR(xlerrvalue)
for instance)

Usually UDFs will only recalculate at each calculation if they contain
Application.volatile. Try to avoid this ny referencing all the input in the
arguments for the function.

see
http://www.DecisionModels.com/calcsecretsj.htm for more information on UDFs


regards
Charles
______________________
Decision Models
FastExcel 2.3 now available
Name Manager 4.0 now available
www.DecisionModels.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top