ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Right click detection (https://www.excelbanter.com/excel-programming/321554-right-click-detection.html)

broogle

Right click detection
 
It possible to trigger the macro right after the user chose (right
click) copy ? thanks


Bob Phillips[_6_]

Right click detection
 
The right-click normally brings up the cell context menu, so it is possible
to do one of two things
- add another menu item to invoke your macro
-disable the menu and invoke your code.

This is an example of the latter on a particular worksheet

Option Explicit

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
MsgBox "hello"
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"broogle" wrote in message
oups.com...
It possible to trigger the macro right after the user chose (right
click) copy ? thanks





All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com