Results 1 to 3 of 3

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

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

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,455
    Location
    Disable events in that other routine, then reset

    [vba]
    Application.EnableEvents = False

    'your code to change cell

    APplication.EnableEvents = True
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Thank you!
    I just found the solution using a better search term .
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •