Temporarily Disabling an Event Macro

  • Thread starter Thread starter stratuser
  • Start date Start date
S

stratuser

I have an event macro on a worksheet. Sometimes, I want
to disable the event macro while I do some monthly
maintenance work on the data on the worksheet. I am
looking for ways to do this that don't require the user to
go into the VBA module (i.e., I don't want him to have to
comment out the VBA code). Any ideas?
 
You could attach this to a button or keyboard shortcut:


Public Sub EventsToggle()
With Application
.EnableEvents = Not .EnableEvents
MsgBox "Event macros are " & _
IIf(.EnableEvents, "dis", "en") & "abled."
End With
End Sub
 
Excellent! Thank you very much.

-----Original Message-----
You could attach this to a button or keyboard shortcut:


Public Sub EventsToggle()
With Application
.EnableEvents = Not .EnableEvents
MsgBox "Event macros are " & _
IIf(.EnableEvents, "dis", "en") & "abled."
End With
End Sub


.
 
Back
Top