View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Endless looping with Worksheet_change event (XL2003)

I obviously did not explain that very well. I should have said "if you have a
code problem DURING DEVELOPMENT and the code stops." I always leave the error
trapping off during development so that I know exactly what line fails.

However, I totally agree that the error trapping should be in the final
production code.

--
Regards,

OssieMac


"Gord Dibben" wrote:

That's why you error trap

On Error Goto errhandler
Application.EnableEvents = False

code that runs and maybe errors

Errhandler:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Tue, 12 Jan 2010 18:05:01 -0800, OssieMac
wrote:

Insert the following as the first line of of your code.

Application.EnableEvents = False

and the following as the last line of the code.

Application.EnableEvents = True

However, if you have a code problem and the code stops before it reaches the
code to turn events back on then they remain off and no events will work.
Therefore you need to re-enable the events with the following sub. Insert the
sub anywhere and to run it just click anywhere in the code and press F5.

Sub Re_EnableEvents()
Application.EnableEvents = True
End Sub


.