ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Suspend old code while new code is running (https://www.excelbanter.com/excel-programming/438676-suspend-old-code-while-new-code-running.html)

Shawn

Suspend old code while new code is running
 
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"??


--
Thanks
Shawn

Dave Peterson

Suspend old code while new code is running
 
application.enableevents = false
'your code
application.enableevents = true

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

Shawn wrote:

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"??

--
Thanks
Shawn


--

Dave Peterson


All times are GMT +1. The time now is 04:49 PM.

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