Suspend old code while new code is running

S

Shawn

I have the following code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Application.Intersect(Range("AD10,AD14"), Target) Is Nothing Then
Module14.CCFCLC_Shan ' Shows a userform
End If

End Sub

I now need to write a new code to copy formats into Range("AD10,AD14"). I
want to suspend the above code while this new code is running so the userform
doesn't "show"??
 
D

Dave Peterson

application.enableevents = false
'your code
application.enableevents = true

Excel won't fire any events (including the _selectionchange event) when events
are disabled.
 

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

Top