disable right click on mouse

J

jatman

is it possible to disable the right click (copy/cut/paste) on a mouse in
excel spreadsheet.

jatman
 
G

Gord Dibben

In the Immediate Window of the VBE

Application.CommandBars("Cell").Enabled = False 'True to reset

You may want it disabled for one worksheet but not another or one workbook and
not others.

Post back with more details if you want something tailored.


Gord Dibben MS Excel MVP
 
J

Jim Rech

Application.Commandbars("Cell").Enabled = False

disables the menu completely. Be sure to enable it or the user will be
stuck with it this way.

Another option is just to disable it on a specific sheet:

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
End Sub

This must be pasted into the sheet's module (right click sheet tab and click
View Code.

Or for an entire workbook:

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
Cancel = True
End Sub

Pasted into the ThisWorkbook module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top