Stop Private Sub when specific Macro Run

mohamed ali abdelgawad

Board Regular
Joined
Nov 18, 2016
Messages
71
Office Version
  1. 365
Platform
  1. Windows
Hi Dear All
Need your help in this case


I created sheet and put this macro on it to track if any cell value changed it make action

Private Sub Worksheet_Change(ByVal Target As Range)


If Not Intersect(Target, Range("A2:a200")) Is Nothing Then

Call Call_Start_1
Call Change_1

End If
End Sub


Also I add this macro in module to clear it to start from beginning
Sub Clear()
'
' Clear Macro
'

'
Range("A2:H300").Select
Selection.ClearContents
End Sub


I want to pause Private Sub action while Macro Clear is running


I hope my bad english help me to deliver to you what I want to do
Thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You mean you want to temporarily disable events (which are procedures that automatically run upon some event happening, like the change of a cell).

Edit you Clear procedure like this:
Code:
[COLOR=#333333]Sub Clear()[/COLOR]
[COLOR=#333333][I]'[/I][/COLOR]
[COLOR=#333333][I]' Clear Macro[/I][/COLOR]
[COLOR=#333333][I]'[/I][/COLOR]
[COLOR=#333333][I]'
[/I][/COLOR][COLOR=#ff0000]    Application.EnableEvents = False[/COLOR]
[COLOR=#333333]    Range("A2:H300").[/COLOR][COLOR=#333333]ClearContents
[/COLOR][COLOR=#ff0000]    Application.EnableEvents = True[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
 
Last edited:
Upvote 0
You mean you want to temporarily disable events (which are procedures that automatically run upon some event happening, like the change of a cell).

Edit you Clear procedure like this:
Code:
[COLOR=#333333]Sub Clear()[/COLOR]
[COLOR=#333333][I]'[/I][/COLOR]
[COLOR=#333333][I]' Clear Macro[/I][/COLOR]
[COLOR=#333333][I]'[/I][/COLOR]
[COLOR=#333333][I]'
[/I][/COLOR][COLOR=#ff0000]    Application.EnableEvents = False[/COLOR]
[COLOR=#333333]    Range("A2:H300").[/COLOR][COLOR=#333333]ClearContents
[/COLOR][COLOR=#ff0000]    Application.EnableEvents = True[/COLOR]
[COLOR=#333333]End Sub[/COLOR]


exactlly what i want

thank you very much :)
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,182
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top