Right click event

G

Guest

How to capture "Clear Contents" Excel right click context menu option.

I want to run a piece of code when user right clicks on a cell and selects
"Clear Contents" context menu option.
 
C

Chip Pearson

Dev,

Put the following code in the ThisWorkbook module.

Private WithEvents Ctrl As CommandBarButton

Private Sub Ctrl_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox "Hello World"
End Sub

Private Sub Workbook_Open()
Set Ctrl = Application.CommandBars.FindControl(ID:=3125)
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
G

Guest

Thanks Chip - this worked great!!.

Do you know the ID for "Insert Copied Cells..."?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top