Application.EnableEvents = FALSE

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
959
Office Version
  1. 2007
Platform
  1. Windows
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.
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Ron Coderre

MrExcel MVP
Joined
Jan 14, 2009
Messages
2,316
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.
 

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
959
Office Version
  1. 2007
Platform
  1. Windows
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:

Formular

New Member
Joined
Sep 27, 2014
Messages
23
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.
 

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
959
Office Version
  1. 2007
Platform
  1. Windows
Okay got it. Writing a line in a code: With Sheets("D3") does what precisely?
 

Watch MrExcel Video

Forum statistics

Threads
1,109,494
Messages
5,529,192
Members
409,857
Latest member
KailuaTown
Top