ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On Change Event (https://www.excelbanter.com/excel-programming/364457-change-event.html)

Jeanne Conroy[_2_]

On Change Event
 
Hi Group:

I created a macro to pop up a message box under certain conditions using the
Workbook_Change property of a worksheet. However sometimes it seems to stop
working. What could cause this?

JJ



Gary''s Student

On Change Event
 
This will happen if worksheet events are left dis-abled.

Many Event macros disable events, do some processing, and then re-enable
them before exiting. If the routine exits prematurally, the dis-able may be
left in effect.
--
Gary's Student


"Jeanne Conroy" wrote:

Hi Group:

I created a macro to pop up a message box under certain conditions using the
Workbook_Change property of a worksheet. However sometimes it seems to stop
working. What could cause this?

JJ




Norman Jones

On Change Event
 
Hi Jeanne,

Just to add to Student's response, in order to prevent the observed
behaviour, when events are disabled in the code, it is advisable to
re-enable events in an error handler, e.g:

'=============
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo XIT
Application.EnableEvents = False

'your code

XIT:
Application.EnableEvents = True
End Sub
'<<=============



---
Regards,
Norman


"Jeanne Conroy" wrote in message
...
Hi Group:

I created a macro to pop up a message box under certain conditions using
the
Workbook_Change property of a worksheet. However sometimes it seems to
stop
working. What could cause this?

JJ






All times are GMT +1. The time now is 05:33 AM.

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