Timesaver Tip: Calculate only selected range of cells

Almir's picture

Sometimes, while working on large workbooks with many complex and slow formulas we set calculation to manulal instead of automatic. From time to time, one needs to calculate only a range of cells. However, pressing F9 (Calculate) calculates all cells, and that can often be time-consuming.

To calculate the selected range of cells only (and to save significant amount of time) when calculation is set to manual, select a range of cells and use a simple macro, like this:


Sub CalculateSelection()
Application.screenupdating = False ' speed up execution by preventing screen flickering
Selection.Calculate ' calculating selected cells
Application.screenupdating = True ' reverting to default settings
End Sub

You could also put timer, in order to see how long it takes to calculate the selected range of cells and compare it to time necessary to full calculation:


Sub CalculateSelectionWithTimer()
Application.ScreenUpdating = False ' speed up execution by preventing screen flickering
Start = Timer ' starting the timer
Selection.Calculate ' calculating selected cells
Finish = Timer ' stopping the timer
Duration = Finish - Start ' calculating execution time
Application.ScreenUpdating = True ' reverting to default settings
MsgBox Duration & " seconds" ' info on duration
End Sub