ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Temporarily Disabling an Event Macro (https://www.excelbanter.com/excel-programming/284149-temporarily-disabling-event-macro.html)

stratuser

Temporarily Disabling an Event Macro
 
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?

J.E. McGimpsey

Temporarily Disabling an Event Macro
 
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

In article ,
"stratuser" wrote:

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?


No Name

Temporarily Disabling an Event Macro
 
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

In article ,
"stratuser" wrote:

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?

.



All times are GMT +1. The time now is 02:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com