Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
while my c# code running ,clicks on excel document interrupts code Kayıhan Excel Programming 2 April 8th 09 11:54 AM
How can I update VBA code in a module that is running my VBA code? Gummy Excel Programming 3 June 12th 07 06:26 PM
how to prevent code running when in a worksheet code Corey Excel Programming 5 August 13th 06 08:52 AM
Suspend macro while others are running Simon Shaw Excel Programming 4 March 21st 05 03:01 PM
Suspend code John Excel Programming 0 August 18th 04 03:15 PM


All times are GMT +1. The time now is 11:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"