Application.EnableEvents = FALSE

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,213
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
Want to understand: what Application.EnableEvents = FALSE does in the code. 1 of my Excel workbook contains multiple worksheets. In 4 worksheets, there are codes & all functioning properly. In a new inserted worksheet in the same Excel workbook, a code is to be pasted which contains Application.EnableEvents = FALSE.

Thanks for having a look at it.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Let's say you have on_change event code in a worksheet and your code will change a cell value.
That would trigger the on_change event and begin an endless loop.
The Application.EnableEvents = False line of code turns off EnableEvents, preventing Excel from sensing the change.
After the code makes the change...turn EnableEvents back on.
 
Upvote 0
What I am trying to figure out is: having Application.EnableEvents = False line in a code that would be pasted in the worksheet module of a worksheet tab named 'D3' would hamper functionality of other codes in the other 4 worksheets of the same Excel workbook or not? Note: The codes in these 4 worksheets are pasted in the worksheet module.

Secondly, writing another line
With Sheets("D3") in the code does what precisely?
 
Last edited:
Upvote 0
Application.EnableEvents = False
will block any event handling on any worksheet until you turn it back on with
Application.EnableEvents = True
It's strongly recommended to do at the end of the same Sub.
 
Upvote 0
Okay got it. Writing a line in a code: With Sheets("D3") does what precisely?
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

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