Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default BeforeRightClick event vs. Selection Change

I have two events that fire when I change the active cell, a BeforeRightClick
and Selection Change. If I select a new cell by right clicking, the code for
the selection change fires. How do I stop the selection change event when I
right click?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default BeforeRightClick event vs. Selection Change

Private Declare Function GetAsyncKeyState Lib "User32" _
(ByVal vKey As Long) As Long


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If GetAsyncKeyState(2&) Then Exit Sub ' right mouse down

End Sub

declare the API function as Public and put it in a normal module if you want
to call it from multiple modules

Regards,
Peter T

"DennisB" wrote in message
...
I have two events that fire when I change the active cell, a
BeforeRightClick
and Selection Change. If I select a new cell by right clicking, the code
for
the selection change fires. How do I stop the selection change event when
I
right click?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default BeforeRightClick event vs. Selection Change

Peter,

I learned something new! This worked great, thank you so much.

Dennis

"Peter T" wrote:

Private Declare Function GetAsyncKeyState Lib "User32" _
(ByVal vKey As Long) As Long


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If GetAsyncKeyState(2&) Then Exit Sub ' right mouse down

End Sub

declare the API function as Public and put it in a normal module if you want
to call it from multiple modules

Regards,
Peter T

"DennisB" wrote in message
...
I have two events that fire when I change the active cell, a
BeforeRightClick
and Selection Change. If I select a new cell by right clicking, the code
for
the selection change fires. How do I stop the selection change event when
I
right click?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
beforerightclick and selection change issue DennisB[_2_] Excel Programming 0 October 28th 08 02:42 PM
Selection Change Event Pflugs Excel Programming 2 June 23rd 06 01:44 PM
Selection Change Event Jim Thomlinson[_3_] Excel Programming 0 April 28th 05 05:36 PM
Selection Change Event Jim Thomlinson[_3_] Excel Programming 3 April 28th 05 10:01 AM
Selection Change Event... Juan Sanchez Excel Programming 1 May 28th 04 10:16 PM


All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"