The code checks to see if A1 was changed and, if it was, to override the value in A1 with the value 1. Enable Events = True Exit Sub Error Handler: Debug. Enable Events is set back to True again before the procedure ends - even if an error occurs. Enable Events is not particularly used to boost up the speed of VBA code, although it can have that effect in certain situations. The problem with this code is, if it changes the value in A1, it results in the Worksheet_Change event handler being called again. You won't be able to see what the macro is doing, but it will run faster.Remember to set the Screen Updating property back to True when your macro ends.These articles are similar to my Code Library articles in that they usually won’t contain an accompanying detailed tutorial.
Code for turning application settings off and on: var excel Settings Manager = new Application Settings Manager(Addin Module. Excel App); //store all settings you are going to tamper with... Save Setting("Enable Events"); excel Settings Manager. Save Setting("Screen Updating"); //change excel setting and do your thing... //when done, restore settings excel Settings Manager. Enable Events End Sub Public Sub Dispose() Implements IDisposable.
Enable Events to false will boost up the speed of macro, but after a batch of googling, i still didn't get how to use it, can some one please explain to me? Setting it to false is usually done because the effect of the event handler is undesirable or to prevent an infinite loop.