ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to stop UDF firing when sheets(n).calculate (https://www.excelbanter.com/excel-programming/329799-how-stop-udf-firing-when-sheets-n-calculate.html)

David

How to stop UDF firing when sheets(n).calculate
 
Greetings and TIA for your time
I have a UDF which is called by cells only on sheets(2) and is neither a
president or dependent of anything in sheets(1)
During running code I have sheets(1).calculate in each pass of a loop. For
some reason this fires the UDF. It fires once for each instance on sheets(2)
This slows the code down considerably
How can I stop the UDF firing?
--
David

Niek Otten

How to stop UDF firing when sheets(n).calculate
 
Hi David,

Is there "Application.Volatile" in the code of the UDF?

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"David" wrote in message
...
Greetings and TIA for your time
I have a UDF which is called by cells only on sheets(2) and is neither a
president or dependent of anything in sheets(1)
During running code I have sheets(1).calculate in each pass of a loop. For
some reason this fires the UDF. It fires once for each instance on
sheets(2)
This slows the code down considerably
How can I stop the UDF firing?
--
David




Jim Thomlinson[_4_]

How to stop UDF firing when sheets(n).calculate
 
Add this line of code at the beginning of the function. It will keep the
function from recalculating

Application.Volatile (False)

--
HTH...

Jim Thomlinson


"David" wrote:

Greetings and TIA for your time
I have a UDF which is called by cells only on sheets(2) and is neither a
president or dependent of anything in sheets(1)
During running code I have sheets(1).calculate in each pass of a loop. For
some reason this fires the UDF. It fires once for each instance on sheets(2)
This slows the code down considerably
How can I stop the UDF firing?
--
David


David

How to stop UDF firing when sheets(n).calculate
 
Nick,

No, no application.volatile ...
--
David


"Niek Otten" wrote:

Hi David,

Is there "Application.Volatile" in the code of the UDF?

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"David" wrote in message
...
Greetings and TIA for your time
I have a UDF which is called by cells only on sheets(2) and is neither a
president or dependent of anything in sheets(1)
During running code I have sheets(1).calculate in each pass of a loop. For
some reason this fires the UDF. It fires once for each instance on
sheets(2)
This slows the code down considerably
How can I stop the UDF firing?
--
David





David

How to stop UDF firing when sheets(n).calculate
 
Thanks Jim, much appreciated
--
David


All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com