ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable events does not work (https://www.excelbanter.com/excel-programming/342905-disable-events-does-not-work.html)

Mika

disable events does not work
 
Hi,

I have several public functions in the workbook I am working with, that
are activated or executed whenever I make changes in the worksheets
trough VBA. Although that is not a problem, it is not a good thing as
it is slowing the execution of the VBA code.

My guess is that the changes of the VBA codes into the worksheets,
clear cells, etc, trigger worksheets changes events.

At the beginning of the VBA code I already used:
application.EnableEvents=False to avoid those unnecessary calls to the
public functions but it does not work.

what am I missing ?


Dave Peterson

disable events does not work
 
Maybe it's not the events firing that is slowing down your macro.

Maybe it's the recalculating after each change.

Turn calculation to manual
do your stuff
turn calculation back to what it was before.

Mika wrote:

Hi,

I have several public functions in the workbook I am working with, that
are activated or executed whenever I make changes in the worksheets
trough VBA. Although that is not a problem, it is not a good thing as
it is slowing the execution of the VBA code.

My guess is that the changes of the VBA codes into the worksheets,
clear cells, etc, trigger worksheets changes events.

At the beginning of the VBA code I already used:
application.EnableEvents=False to avoid those unnecessary calls to the
public functions but it does not work.

what am I missing ?


--

Dave Peterson

Mika

disable events does not work
 
Duh !!, of course thank you, that was the problem !!!. I wonder why the
enable events doesn´t work thoug.


Dave Peterson

disable events does not work
 
I bet disabling events did help (if you had events that would have fired). But
not as much as the calculation stuff (in this case).

Mika wrote:

Duh !!, of course thank you, that was the problem !!!. I wonder why the
enable events doesn´t work thoug.


--

Dave Peterson


All times are GMT +1. The time now is 03:57 PM.

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