Disable right-click for multiple worksheets

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,825
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
This code will prevents users from right-clicking ON THE TAB itself:


Code:
Application.CommandBars("Ply").Enabled = False


but it only works if the user tries to right-click a SINGLE tab.


If they select more than one tab and right-click, they are still able to do so.


Is there some code that prevents users selecting multiple tabs and right-clicking?


Thanks
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
What version of Excel are you using? There is only one Ply menu as far as I know and it's the same one shown in both situations. Certainly in 2010 disabling it prevents it popping up in either scenario.
 
Upvote 0
I'm using Excel 2010.

Assume I have three worksheets in my workbook.

I am currently on Sheet1. I left-click on the Sheet2 tab, then holding down the Ctrl key, I also left-click on the Sheet3 tab, so now both Sheet2 and Sheet3 are selected.

I then right-click on either tab. I agree the menu does not pop up.

However, I have a Worksheet_Activate event on both Sheet2 and Sheet3 and it gets activated, which I don't want.
 
Last edited:
Upvote 0
However, I have a Worksheet_Activate event on both Sheet2 and Sheet3 and it gets activated, which I don't want.

That has nothing at all to do with the subject of your thread as far as I can see. Clicking on Sheet2 activates it and therefore the activate event will fire. The only way around that is to disable events.
 
Upvote 0
That has nothing at all to do with the subject of your thread as far as I can see. Clicking on Sheet2 activates it and therefore the activate event will fire. The only way around that is to disable events.

Sorry, I realised afterwards.

FYI, this is my workaround for my problem is disabling the Activate event.

I added this in the Worksheet_Activate event:

Code:
    If ActiveWindow.SelectedSheets.Count = 1 Then
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

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