Changing the Shortcut Menu

by Allen Wyatt
(last updated January 16, 2014)

The shortcut menus that you see when you right-click on different objects can be very helpful. In Word, it is relatively easy to change the shortcut menus. In Excel, however, changing the menus—while possible—is nowhere near as easy.

In Excel, you can only change the options on a shortcut menu by using VBA. The exact code you use depends on whether you are removing items from a shortcut menu or adding them in. The following code illustrates how to delete an item from a shortcut menu:

Sub Del_Item()
    CommandBars("Cell").Controls("Cut").Delete
End Sub

Each shortcut menu is really a member of the CommandBars collection, and can thus be manipulated in VBA. In this case, a CommandBar by the name of "Cell" is being manipulated. This just happens to be the command bar for the shortcut menu that appears when you right-click on a cell in a worksheet. Excel has 47 named shortcut menu CommandBars.

If you want to add a command to a shortcut menu, all you do is use code similar to the following:

Sub Add_Item()
    CommandBars("Cell").Controls.Add _
      Type:=msoControlButton, Id:=21, _
      Before:=1
End Sub

In this instance you are again manipulating the shortcut menu that appears when you right-click on a cell. You are adding a command that is defined by the Id value setting. In this case, the Id value is 21, which represents the Cut command. There are scores, if not hundreds, of different command IDs within Excel.

To aid you in determining both the Id to use for a command, as well as the names of the various shortcut menu CommandBars, you should refer to the Knowledge Base article 213552. This article is quite long, and can be found at the following address:

http://support.microsoft.com/kb/213552

The article is written for Excel 2000, but is also applicable to later versions of Excel, through Excel 2003.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (1962) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Understanding Single Line Spacing

Single line spacing, the default spacing used in a paragraph, allows Word to adjust the spacing of individual lines in a ...

Discover More

Working With Multiple Workbooks

Need to do work in more than one workbook at a time? For many, this ability is a necessity. Excel allows you to easily work ...

Discover More

Dealing with Long Formulas

If your worksheet formulas seem to go on forever, here's a handy way to make them more understandable. (All you need to do is ...

Discover More

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!

MORE EXCELTIPS (MENU)

Resetting Excel Menus

Excel allows you to easily change what appears on its menus. If you later want to return to Excel's default menu structure, ...

Discover More

Making Short Work of Menu Names

If your menu bar has become cluttered due to different add-ins you've added, you can free up space by shortening the menu ...

Discover More

Adding Your Own Menu Items

Want to really make Excel reflect how you work? Why not make some changes to the menu structure so that the menus have your ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments for this tip:

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 8?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.

Links and Sharing