Disable macro at runtime

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

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
 
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)
 
Perfect thank you
Sandy

Bob Phillips said:
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top