prevent UDF from executing

  • Thread starter Thread starter masterphilch
  • Start date Start date
M

masterphilch

Hi

I did some UDF on a worksheet. In some cases, I want to prevent
executing the UDF, even if an argument changed. This, just because some
processec take too much time. Is that possible?

thanks a lot for help

masterphilch
 
The only way to do that would be to put in an argument that tells
the UDF to return some value (e.g., #NA or 0 or "") without doing
the real calculation.


Public Function MyUDF(<your regular arguments>, _
Optional NoCalc As Boolean = False)
If NoCalc = True Then
MyUDF = CVErr(xlErrNA)
Exit Function
End If
' rest of your code
End Function


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
masterphilch said:
Hi

I did some UDF on a worksheet. In some cases, I want to prevent
executing the UDF, even if an argument changed. This, just because some
processec take too much time. Is that possible?

thanks a lot for help

masterphilch
--------------------------

What I have done where I have a UDF which is not required 99.9% of the time is
to create 2 macros I can execute from a button on the spreadsheet. One of them
cycles through all the worksheets and replaces all instances of the function in
cells with its current result as a fixed number. The other one cycles through
the worksheets and puts the function back into the proper cells if I actually
need it.

There may well be a more elegant approach.

Bill
 
Bill said:
--------------------------

What I have done where I have a UDF which is not required 99.9% of the time is
to create 2 macros I can execute from a button on the spreadsheet. One of them
cycles through all the worksheets and replaces all instances of the function in
cells with its current result as a fixed number. The other one cycles through
the worksheets and puts the function back into the proper cells if I actually
need it.

There may well be a more elegant approach.

Bill

Hi

thanks for your reply!

I already thought about clear the cells in which the UDF is written and
reenter the content, when needed. I need to think, what's really needed.

thanks anyway!
 

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

Similar Threads

optional args in UDF 4
UDF Not Recognized 2
Another UDF Question 5
UDF Frustration - Won't Update 3
Help with UDFs in Excel 2010 3
UDF-event mishap 1
Update cell value while dragging UDF 4
UDF with user help 5

Back
Top