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:
- Option Explicit
- Private Sub WorkSheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
- Cancel = True
- MsgBox "Shortcut Menu is disabled."
- 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".
b) When user right clicks on "Sheet1" a message "Shortcut Menu is disabled" pops up as below.