How to suppress the worksheet_change event ?

Sparkle99

Board Regular
Joined
May 22, 2009
Messages
119
My VBA code is changing sheet2 (clearing cells, setting formats, adding formulas...)
sheet2 has worksheet_change to set the cells in bold when changed - based on a value set only when sheet2 is saved to a new file.
All of this is working fine.

Except, the code to change sheet2 is causing the worksheet_change event to happen (no value set, so the code is skipped) - BUT this does seem to be slowing things down quite a bit.

So, can worksheet_change be suppressed for a period ?

Can the worksheet_change code be added at the end of the main routine by VBA code ?

Any advice greatfully received.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You can disable/enable events with the Application.EnableEvents property. For more see
Monitoring events
http://www.tushar-mehta.com/excel/vba/vba-XL events.htm
particularly the sections
Recursive calls to the same event procedure
and
An Excel specific trap: the EnableEvents property

My VBA code is changing sheet2 (clearing cells, setting formats, adding formulas...)
sheet2 has worksheet_change to set the cells in bold when changed - based on a value set only when sheet2 is saved to a new file.
All of this is working fine.

Except, the code to change sheet2 is causing the worksheet_change event to happen (no value set, so the code is skipped) - BUT this does seem to be slowing things down quite a bit.

So, can worksheet_change be suppressed for a period ?

Can the worksheet_change code be added at the end of the main routine by VBA code ?

Any advice greatfully received.
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,702
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top