Disable the Right-Click Menu in a Worksheet
July 22nd, 2007If for some reason, you need to disable the right click or shortcut menu in a worksheet, then you can place the code below in the code module of a worksheet.
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
MsgBox "Sorry, right-click menus are disabled!"
Cancel = True
MsgBox "Sorry, right-click menus are disabled!"
End Sub
2 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
(C) by Virgilio Adriano. All rights reserved. Powered by WordPress.
Entries and comments feeds.
It took 0.266 seconds to load this page.
I’ve inserted the “cancel = true” into my VBA code for the worksheet I wanted to disable the menu on. However, after I right click it insists on popping up. Is there another step I need to perform that I’m missing or can 2007 version of excel not handle this code any more?
Comment by Duke — October 6, 2011 #
I don’t have Excel 2007, but the code does work in Excel 2010.
Comment by Vergel — October 6, 2011 #