The Problem (Q-score 4, ranked #221st of 303 in the Excel VBA archive)
The scenario as originally posted in 2013
I am fixing a spreadsheet. The programmer made a macro for each sheet to fire when the sheet is changed. This is good because it colour co-ordinates the sheet details when new information is added so I would like to keep this feature.
I have written a macro which sorts the data and allows for removal and addition of new employees, this is in conflict with the change event macro and is causing my macro to have errors if they are both operational.
Q. Is there a way to bypass the worksheet change event while the macro is running and then have it in place again once the macro is finished?
Here is the code for the change event.
Private Sub Worksheet_Change(ByVal target As Excel.Range, skip_update As Boolean)
If skip_update = False Then
Call PaintCell(target)
End If
End Sub
My macro is bringing up errors when I refer to worksheets or ranges.
Why this Range / Worksheet targeting trips people up
The question centers on reaching a specific cell, range, or workbook object. In Excel VBA, this is the #1 source of failures after activation events: every property (.Value, .Formula, .Address) behaves differently depending on whether the parent Workbook is explicit or implicit.
The Verified Solution — niche answer (below median) (+9)
4-line Excel VBA pattern (copy-ready)
I think you want the EnableEvents property of the Application object. When you set EnableEvents to False, then nothing your code does will trigger any events and none of the other event code will run. If, for example, your code changes a cell it would normally trigger the Change event or the SheetChange event. However, if you structure it like this
Application.EnableEvents = False
Sheet1.Range("A1").Value = "new"
Application.EnableEvents = True
then changing A1 won’t trigger any events.
Sometimes it’s beneficial to have to have your code trigger event code and sometimes it’s not. Use EnableEvents when you want to prevent it.
When to Use It — classic (2013–2016)
Ranked #221st in its category — specialized fit
This pattern sits in the 97% tail relative to the top answer. Reach for it when your scenario closely matches the question title; otherwise browse the Excel VBA archive for a higher-consensus alternative.
What changed between 2013 and 2026
The answer is 13 years old. The Excel VBA object model has been stable across Office 2013, 2016, 2019, 2021, 365, and 2024/2026 LTSC, so the pattern still compiles. Changes that might affect you: 64-bit API declarations (use PtrSafe), blocked macros in downloaded files (Mark-of-the-Web), and the shift toward Office Scripts for web-first workflows.