Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default prevent UDF from executing

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default prevent UDF from executing

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" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default prevent UDF from executing

masterphilch wrote:
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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default prevent UDF from executing

that's what I thought...

I'll try to handle that somehow else...

thx
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default prevent UDF from executing

Bill Martin schrieb:
masterphilch wrote:
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


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!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW CAN I PREVENT EXCEL FILES FROM BEING DELETED OR PREVENT TRASH ROB Excel Discussion (Misc queries) 2 April 2nd 07 01:13 PM
need to modify a macro to prevent it from executing if in wrong area of the sheet Tonso Excel Discussion (Misc queries) 3 February 11th 07 08:00 PM
executing an add in Gary Keramidas Excel Programming 6 November 6th 05 09:56 PM
Worksheet_Change Still Not Executing.... [email protected] Excel Programming 0 September 3rd 04 11:50 PM
Code not executing iwrk4dedpr[_6_] Excel Programming 3 June 3rd 04 07:48 AM


All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"