Right Click Event

danbates

Board Regular
Joined
Oct 8, 2017
Messages
246
Hi,

I've just added a right click event to call a macro which works fine but it also it is bringing up the normal cut and paste menu.

How can I disable just the cut and paste menu?

Thanks

Dan
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,427
Where is this right click event.
Is this in a userform activex control sheet or what?
 

danbates

Board Regular
Joined
Oct 8, 2017
Messages
246
It's just on a normal sheet and on any cell but it's restricted to a certain row each time via the cells being locked and protected. Here is my code:
Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Call BlankOutDRS
End Sub
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,427
OK. I see what you mean.
I have no answer.
Why not use a double click event?
Double click the cell and it does something.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,427
Example:
Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 3 Then
Cancel = True
Call BlankOutDRS
End If
End Sub
 

danbates

Board Regular
Joined
Oct 8, 2017
Messages
246
Hi,

That's sorted it. Thank you again :)

I didn't want to use the double click event because I'm already using that for something else and I am trying to make the sheet as user friendly as possible.

Thank again for your help.

Kind Regards
Dan
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,427
Not sure if you mean you found a answer to the right click problem or just decided to use double click.
If you find a answer to the right click problem let us know.
Glad I was able to help you. Come back here to Mr. Excel next time you need additional assistance.

Hi,

That's sorted it. Thank you again :)

I didn't want to use the double click event because I'm already using that for something else and I am trying to make the sheet as user friendly as possible.

Thank again for your help.

Kind Regards
Dan
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,544
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
To cancel the default menu, you use the same technique as with the DoubleClick event, namely adding:
Code:
Cancel = True
to the code.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,427
That is nice to know.

I use that on double click but to be honest I really do not know what that means but it works.
To cancel the default menu, you use the same technique as with the DoubleClick event, namely adding:
Code:
Cancel = True
to the code.
 

Forum statistics

Threads
1,085,584
Messages
5,384,583
Members
401,911
Latest member
bluesquared

Some videos you may like

This Week's Hot Topics

Top