Deny Worksheet_Change event

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,202
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a workbook open event that defaults values of certain cells in a worksheet.
As it's doing so, it is triggering the worksheet_change event (triggers code with a specific user cell entry) with each cell that is defaulted.

Is there a way to prevent the worksheet change event from occuring during this process?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,772
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Use:
Code:
Application.Enableevents = False
' code that changes cells
Application.Enableevents = True
in your Open event.

Oh and ideally, the code to re-enable events would be in an error handler to ensure it always gets called!
 

DanD

Board Regular
Joined
Dec 23, 2008
Messages
124
Application.enableevents = False/True

Will turn events, such as worksheet_change on and off

Must learn to type faster!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,514
Messages
5,832,192
Members
430,114
Latest member
kefier

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
Top