Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BeforeRightClick event vs. Selection Change

0 views
Skip to first unread message

DennisB

unread,
Oct 28, 2008, 3:16:05 PM10/28/08
to
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?

Peter T

unread,
Oct 28, 2008, 4:00:12 PM10/28/08
to
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" <Den...@discussions.microsoft.com> wrote in message
news:FBFE48CC-F999-4F6D...@microsoft.com...

DennisB

unread,
Oct 28, 2008, 5:26:00 PM10/28/08
to
Peter,

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

Dennis

0 new messages