PDA

View Full Version : Solved: How to stop an 'on_change' subroutine running if I make a change via another subrouti



cchris_uk
03-23-2009, 07:25 AM
Hi,

I have a Sub Worksheet_Change(ByVal target As Range) subroutine that watches for changes on various columns.

I need a way to stop this subroutine being called if I edit a cell from within another subroutine; is there an easy way to do this?

I tried setting a boolean variable in my subroutine to 'true' and having the Worksheet_change subroutine check if it was 'true' and exiting if it was, but this does not seem to work.

Regards,

Chris

Bob Phillips
03-23-2009, 07:28 AM
Disable events in that other routine, then reset


Application.EnableEvents = False

'your code to change cell

APplication.EnableEvents = True

cchris_uk
03-23-2009, 07:38 AM
Thank you!
I just found the solution using a better search term :bug:.
I think I got too flustered as I tried to get this to work for a few days!

Thank you for confirming the solution.

Regards,
Chris