BeforeRightClick event vs. Selection Change

  • Thread starter Thread starter DennisB
  • Start date Start date
D

DennisB

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?
 
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
 
A while back I got this suggestion to allow my VBA right click to run rather than the selection change event.

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

This works great, but this errors on a 64 bit computer. Any ideas?
 
Back
Top