Timesaver Tip: Calculate only selected range of cells
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
- Almir's blog
- Login or register to post comments
- 36492 reads
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago