disable right click in workbook in Excel

Q139. In Excel, how do I disable the right click option for users in my WorkSheet?

To do it in Excel, here is the answer:

  1. Option Explicit
  2. Private Sub WorkSheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
  3. Cancel = True
  4. MsgBox "Shortcut Menu is disabled."
  5. End Sub

a) The above macro code needs to be included under the Sheet where "Right Click" has to be disabled. In the example below, the code is included in "Sheet1" - hence right click is disabled for "Sheet1".

excel disable right click in workbook

b) When user right clicks on "Sheet1" a message "Shortcut Menu is disabled" pops up as below.

excel excel disable right click in workbook

 

You can find similar Excel Questions and Answer hereunder

1) How do I use Find to determine last occurrence of a string in a WorkSheet range using VBA?

2) I am considering an investment of $500 per month for 3 years @ 6% interest rate. What is the Present Value of investment?

3) How can I quickly navigate to a frequently used field in a voluminous worbook?

4) How can I save a WorkSheet as a new WorkBook using VBA?

5) How can I get the most frequently occurring text in a range?

6) How can I get the last non-zero value in a row?

7) How can I dynamically add a hyperlink using VBA?

8) How can I quickly navigate to a frequently used field in a voluminous worbook?

9) How can I add interval to dates?

10) I have angle values in radians. In Excel, how can I convert them to degrees?

11) How to disable ability to insert Rows and Columns in Excel (using VBA)?

12) I want to automatically run an initialization procedure whenever I open my WorkBook so that it is ready for use - how can I achieve that?

13) Import txt file in Excel

14) How can I enter an Engineering or Mathematical equation like Binomial Theorem Equation in Excel?

15) Userform initialize vs userform show in Excel