ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Disable macro at runtime (https://www.excelbanter.com/excel-worksheet-functions/142512-disable-macro-runtime.html)

Sandy

Disable macro at runtime
 
How do you disable a macro from within another macro eg

Sub Sample_Data()

disable macro - "Private Sub Worksheet_Change(ByVal Target As Excel.Range)"

macro "Sample_Data" does its thing

enable - "Private Sub Worksheet_Change(ByVal Target As Excel.Range)"

End Sub

Thanks
Sandy



Bob Phillips

Disable macro at runtime
 
Sub Sample_Data()

Application.EnableEvents = False

macro "Sample_Data" does its thing

Application.EnableEvents = True

End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Sandy" wrote in message
...
How do you disable a macro from within another macro eg

Sub Sample_Data()

disable macro - "Private Sub Worksheet_Change(ByVal Target As
Excel.Range)"

macro "Sample_Data" does its thing

enable - "Private Sub Worksheet_Change(ByVal Target As Excel.Range)"

End Sub

Thanks
Sandy




Sandy

Disable macro at runtime
 
Perfect thank you
Sandy

"Bob Phillips" wrote in message
...
Sub Sample_Data()

Application.EnableEvents = False

macro "Sample_Data" does its thing

Application.EnableEvents = True

End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Sandy" wrote in message
...
How do you disable a macro from within another macro eg

Sub Sample_Data()

disable macro - "Private Sub Worksheet_Change(ByVal Target As
Excel.Range)"

macro "Sample_Data" does its thing

enable - "Private Sub Worksheet_Change(ByVal Target As Excel.Range)"

End Sub

Thanks
Sandy







All times are GMT +1. The time now is 05:28 AM.

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