Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Manipulate Selection_Change Event (Excel VBA 2000>)

    Is it possible to manipulate the Selection_Change event so that it only triggers within a certain range of cells, and NOT across the entire spreadsheet?
    EG: If I am in rage A1: D10, the event must trigger while selection / moving in this range, but it must be disabled when in any other area on the sheet.

    Tx
    Regards,
    Rudi

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Manipulate Selection_Change Event (Excel VBA 2000>)

    Yup:

    Inside the event code stub, include something like:

    If Intersect(Target,Me.Range("A1:A10") Is Nothing Then Exit Sub

    To make it more flexible, you could name the range of cells that should be handled and check against that named range instead of a fixed address like in my example.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Manipulate Selection_Change Event (Excel VBA 2000>)

    Thx Pieterse. This will be useful.

    PS: In your opinion, will this speed up code execution by doing this??
    Regards,
    Rudi

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Manipulate Selection_Change Event (Excel VBA 2000>)

    Depends on the code. More important is if the code does what you want...
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Manipulate Selection_Change Event (Excel VBA 2000>)

    Yes thx. Its good!
    Regards,
    Rudi

Posting Permissions

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