T
Thomas
Hi there,
I have a UDF that takes a long time to execute and I need to make sure
it is not evaluated more than required per workbook calculation.
I found on www.decisionmodels.com/calcsecretsj.htm that I can use
IsEmpty(arg) to detect that my inputs arguments are 'dirty' (i.e. have
not been recalculated yet) and therefore that it is not worth
performing the full procedure and rather exit early, and wait to be
called again when the argument is 'clean':
Public Function myfunction(arg1 As Range, arg2 As Range)
Debug.Print "entry"
If IsEmpty(arg1) Or IsEmpty(arg2) Then
Debug.Print "exit on dirty"
Exit Function
End If
' ...proper procedure there
Dim inc As
It seems to work fine on simple inputs arguments, yet it seems to be
ineficient if the input argument is a multi areas range: IsEmpty
returns false although I'm sure some of the cells have not been
recalculated yet.
Would it be enough to test all the areas in the input? What about
multi-cell ranges, do I need to test every single cell?
Is there a more efficient way to optimise excel recalculation
sequence?
Thanks
Thomas
I have a UDF that takes a long time to execute and I need to make sure
it is not evaluated more than required per workbook calculation.
I found on www.decisionmodels.com/calcsecretsj.htm that I can use
IsEmpty(arg) to detect that my inputs arguments are 'dirty' (i.e. have
not been recalculated yet) and therefore that it is not worth
performing the full procedure and rather exit early, and wait to be
called again when the argument is 'clean':
Public Function myfunction(arg1 As Range, arg2 As Range)
Debug.Print "entry"
If IsEmpty(arg1) Or IsEmpty(arg2) Then
Debug.Print "exit on dirty"
Exit Function
End If
' ...proper procedure there
Dim inc As
It seems to work fine on simple inputs arguments, yet it seems to be
ineficient if the input argument is a multi areas range: IsEmpty
returns false although I'm sure some of the cells have not been
recalculated yet.
Would it be enough to test all the areas in the input? What about
multi-cell ranges, do I need to test every single cell?
Is there a more efficient way to optimise excel recalculation
sequence?
Thanks
Thomas