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
- 36455 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago