by Allen Wyatt
(last updated March 12, 2016)
Don likes to use the Context menus that appear when he right-clicks on a cell. Once the Context menu is visible, he can press a shortcut key of whichever command he wants to perform. (The shortcut key is the underlined letter for each option on the Context menu.) The problem is that the Context menu has two items that use the same shortcut key: Copy and Create List. Since he never uses the Create List option, Don would love to get rid of it completely, so that only the Copy command is initiated by the C shortcut key.
The only way to change the Context menus is through a macro. The code to perform such a change is identical to the code used for other menus or command bars. There is a huge discussion (much too big for this tip) on how to make these types of changes in the Microsoft Knowledge Base, at this address:
Additional information, specific to Context menus (what Microsoft confusingly calls Shortcut menus), can be found in this Knowledge Base article:
While there is a wealth of information in these two articles, the actual code to modify the Context menu that appears when you right-click a cell is relatively simple. In fact, it can be boiled down to a single-line macro:
Sub RemoveCreateList() Application.CommandBars("Cell").Controls("Create List...").Delete End Sub
Run the macro, and the Create List item is gone. You could remove any other item from the menu by simply replacing the "Create List..." text with the exact wording of the menu item you want to remove. When you later want to restore the menu, you run another single-line macro to reset it:
Sub ResetMenu() Application.CommandBars("Cell").Reset End Sub
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3089) applies to Microsoft Excel 97, 2000, 2002, and 2003.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
Excel allows you to customize your menus so that they contain the commands you want on them. If you later want to delete an ...Discover More
Want your copy of Excel to reflect the way you want to work with the interface? Fortunately, you can modify where various ...Discover More
Context menus can be very helpful for presenting common operations you can perform, based on the context in which the menu is ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.