LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Suspend macro while others are running

Hi Simon,

No, what I am saying is that if you don't trap errors, and the code bombs
nosily, or even exits quietly, it won't get to your code that resets events
to True. This is an example of how I handle it in the worksheet_change
event, but this is only an example, it may not be appropriate for your code

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then
With Target
'do your stuff
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

The aim is to9 always make it set the events to true.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Simon Shaw" <simonATsimonstoolsDOTcom wrote in message
...
Hi Bob,

Thanks, I did set it to true at the end of my procedure.

However, is there something I should be aware of during the execution
procedures while enableevents is set to false? Are you saying that error
trapping occurs differently if it is set to false?


"Bob Phillips" wrote:

But make sure that you reset them afterwards, or you will get odd things
happening. That means catering for any errors in your macro to reset

them.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"galimi" wrote in message
...
Simon,

You can disable Sheet/Workbook events with the following command

application.enableevents=false

http://HelpExcel.com

"Simon Shaw" wrote:

Hi,

Can I stop the event macro assigned to a sheet:

Private Sub Worksheet_Change(ByVal Target As Range)

'details

end sub

while other macros act on the sheet?









 
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
suspend auto increment Bill Johnson Excel Discussion (Misc queries) 6 February 8th 08 06:26 PM
Suspend window while Excel VBA macro is executing Knut S Excel Programming 4 November 17th 04 02:21 PM
Suspend code John Excel Programming 0 August 18th 04 03:15 PM
Screen suspend eyecalibrate[_3_] Excel Programming 2 March 3rd 04 04:44 PM
Suspend/resume running of a macro Peter[_20_] Excel Programming 3 February 9th 04 01:49 PM


All times are GMT +1. The time now is 02:27 AM.

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

About Us

"It's about Microsoft Excel"