Written by Allen Wyatt (last updated August 30, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021
Brendon created a very simple macro to save the current workbook and close it. He then added an icon to the Quick Access Toolbar (QAT) for the macro. The macro works well if the user isn't in Edit mode in the worksheet. If, for example, a user enters data in a cell but never presses Enter or doesn't select a different cell, then the macro won't run. It's like the QAT icon is greyed out. Brendon wonders how he can get around this and force the macro to run.
Brendon has run up against one of the fundamental limitations of Excel—you cannot run a macro while you are in Edit mode. In fact, there are many things you cannot do while you are in Edit mode—for instance, most of the ribbon tools aren't available, and most shortcut keys won't work. Excel limits what you can do to only those things dealing with editing the cell contents.
The solution is to get out of Edit mode before running the macro. One easy way to do this is to (as Brendon points out) simply press Enter or press Tab to move to a different cell.
If training the user to do that is a bit too much, then you might place your macro somewhere else besides the QAT. The most effective approach would be to place a shape in your workbook and then attach the macro to that shape. (How to actually do this is a bit beyond the scope of this particular tip.) The shape—which you would need to design in a graphics program—could look a "button" that says something like "Click here to save and exit." The user, in clicking on the shape, would automatically leave Edit mode, which means the macro attached to the shape would run.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13736) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021.
Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!
Need to know the character code used for a particular character? In a macro you can use the Asc function to determine the ...
Discover MoreWhen you record a macro, make sure that you know how Excel is recording your cell movements. This tip explains the ...
Discover MoreAs you format your worksheet, Excel allows you to add page breaks where you'd like. If you want to put in a series of ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-02-08 15:25:19
John Mann
While it's possible to use a graphics programme to design a shape to be used as a button, it's not necessary (a tleast not in Excel 10).
On the Ribon, click "Insert" then "Shapes" Choose a shape you like, edit it in the way you desire, and the wished for text. Then right click the shape and from the context menu select "Assign Macro..." From now on you can either add an existing macro or create a new one.
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments