Written by Allen Wyatt (last updated November 17, 2021)
This tip applies to Excel 2007, 2010, 2013, and 2016
Linda asked if there is a way to calculate only the active workbook. When a recalc is performed by Excel, it recalculates all her open workbooks, and if they are very large workbooks it can sometimes take over fifteen minutes to recalc. If she is able to limit what is recalculated, then the process will obviously run faster.
Unfortunately, there is no direct method to just calculate a particular workbook. You can, however, calculate just the active worksheet, if desired. First, set the recalculation mode to manual by following these steps:
Figure 1. The Formulas options of the Excel Options dialog box.
Now the only time your workbook (actually, all your open workbooks) will be recalculated is when you press F9. If you want to recalculate only the current worksheet, then press Shift+F9.
Excel also provides macro functions that allow you to do any of these three things: calculate all open workbooks, calculate a specific worksheet in a workbook, or calculate a specified range of cells on a worksheet. With this knowledge you could create a macro that would loop through all the worksheets in a workbook and recalculate each of them.
The following macro sets the calculation mode to manual (so the other workbooks will not calculate) and then loops through and calculates each sheet of the active workbook.
Sub CalcBook() Dim wks As Worksheet Application.Calculation = xlManual For Each wks In ActiveWorkbook.Worksheets wks.Calculate Next Set wks = Nothing End Sub
If you believe that you may want to calculate different parts of your workbook at different times, you can expand the macro so that it will perform any type of calculation you may want:
Sub CalcWhat() Dim iAnsure As Integer Application.Calculation = xlManual iAnsure = InputBox("1 = Calculate A Used Range" _ & vbCrLf & _ "2 = Calculate This Worksheet" _ & vbCrLf & _ "3 = Calculate This Workbook" _ & vbCrLf & _ "4 = Calculate All Workbooks in Memory" _ & vbCrLf & vbCrLf & _ "Input Your Selection Number From Above" _ & vbCrLf & "Then Click OK", _ "Calculate What?", "Input Number Please", _ 5000, 5000) Select Case iAnsure Case 1 'Range Only Selection.Calculate Case 2 'Worksheet Only ActiveSheet.Calculate Case 3 'Workbook Only For Each wks In ActiveWorkbook.Worksheets wks.Calculate Next Case 4 'All Open Workbooks Application.CalculateFull End End Select End Sub
This macro presents an input box that prompts the user as to which type of recalculation is desired. When the user enters a number from 1 to 4, the desired type of recalculation is performed.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6752) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Calculating Only the Active Workbook.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
Named ranges are a great tool to use in developing formula-heavy workbooks. You may want, at some point, to copy your ...
Discover MoreWhen running a macro, have you ever seen Excel appear to stop responding? This can be frustrating, but there are a couple ...
Discover MoreWhen sharing workbooks with others, you may find that the macros in those workbooks may not work as you expect. This tip ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2021-11-17 13:05:05
Dave Bonin
I had a slightly similar situation where I had one worksheet with a lot of data and many other large, complex worksheets (reports) that fed off the first worksheet. The "report" worksheets were computationally complex, which made the workbook very slow to recalculate.
The approach I took used Worksheet Activate and Deactivate events.
Since I didn't care what the non-active "report" worksheets looked like (I couldn't see them because they were not active), and because none of them depended on each other, I could disable the formulas on the non-active worksheets.
Essentially, I wrote a Worksheet Deactivate macro which replaced every instance of "=" with "[=]". That changed every formula into a text string as I left the sheet. (And text never gets recalculated because it's not a formula.)
I similarly wrote a Worksheet Activate macro which replaced every instance of "[=]" with "=". (For robustness, I did that find and replace several times in the activate macro in case things had gotten out of sync. )
The net result was that every non-active "report" worksheet had no no formulas -- just text strings that could easily be turned back into formulas when the sheet was activated. This changed my workbook recalculation time from several minutes down to just several seconds.
If you can write macros, you can implement this pretty easily.
2020-12-02 17:02:35
J
Did previous versions of Excel always calculate every Open Workbook OR is this just a feature of newer versions of Excel? I feel like with 2010 I never ran into this problem as frequently as I do now.
2018-05-09 22:33:37
Col Delane
The Sub CalcBook() isn't guaranteed to generate the desired outcome (i.e. a fully calculated workbook). "Sheet1" might contain formulas pointing to cells in "Sheet2", but other cells in "Sheet2" might have dependencies back on "Sheet1" or elsewhere. So, calculating each Worksheet once might not be enough to perform a full calculation on your Workbook, as Excel doesn't look at the whole calculation tree for the workbook and recalculate all precedents from the top down when just doing one worksheet.
2016-04-26 12:38:52
Willy Vanhaelen
@Anthony Ogilvie
A shorter way to launch another instance of Excel:
simply click on the Excel icon on the taskbar while holding down the Shift key.
2016-04-25 08:36:07
Anthony Ogilvie
Another method that I use is to start another of instance. This is done by right clicking the Excel icon on the task bar then click on the Excel application icon whilst holding down the Alt key, do not release until Excel asks if you want to start another instance, click yes. This will then set up another group of workbooks and will only recalculate that group.
2016-04-23 11:42:48
I wonder whether this could be the solution to a problem I regularly run into: I'm running Win 7 Pro 64 bit on a 3.2 GHZ i7 960 system with 24 GB RAM and an SSD boot drive (it's a pretty fast system). I often have a workbook open, which has several tabs loaded with formulas. Sometimes when I try to open another workbook I get a Windows error message saying I don't have enough memory to open the workbook, which on paper seems ludicrous.
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 © 2023 Sharon Parq Associates, Inc.
Comments