Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Worksheet Event Order

    I am having problems controlling the order of execution of two event procedures.

    I have a Worksheet_SelectionChange procedure as well as a Worksheet_BeforeRightClick procedure. If the user Right-clicks in the worksheet I want to be able to stop the SelectionChange procedure.
    The problem is that Excel always runs the SelectionChange procedure (and any sub procedures it calls) in full before the Worksheet_BeforeRightClick procedure starts, thus giving me no opportunity to stop the SelectionChange proc. running.

    Any suggestions?

  2. #2
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Worksheet Event Order

    It is quite normal that Excel first executes the selectionchange event before the beforerightclick event. Could it be that you need the worksheet_change event instead of the worksheet_selectionchange event? The last event only executes if something has changed in a particular cell. Another possibility might be to temporarily disable the events, using application.enableevents = false. Of course, when you want events to occur again, you'll have to switch on this using application.enableevents = true.

    Hope this helps.

Posting Permissions

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