Problem with "Worksheet_BeforeRightClick"

Fibo

New Member
Joined
Oct 22, 2023
Messages
17
Office Version
  1. 365
Platform
  1. Windows
I just changed computer and my .xlsm file (which is strored on google drive) doesn't behave correctly on right clicks.
If the selected cell is A1 for example. If I then right click on C3, instead of executing the code thats within "Worksheet_BeforeRightClick" it doesn't execute the code immediatly.
The first thing it does is deploy the dropdown menu below C3 and select C3. If I then right click again, it execute the code.
So I have to right click twice and I have an undesired dropdow menu on the first click.

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

fs I rightclick any cell on the sheet that contains this code, it will first show me the drop down menu (the one that should not apear thanks to Cancel=true) and select the cell.
I have to right click a second time for "Hi" to pop in the message box and the dropdown menu won't appear which is the desired effect.
Does anyone knows the solution to this problem?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Ok, I Just found the problem.
In excel 365 the following option has to be checked:
File/More/Options/Trust Center/Trust Center setting...
1706266832975.png
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,138
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top