Question regarding "Sheets("Sheet1").Range("A1:A10").Calculate" vs "Application.Calculation = xlManual/xlAutomatic"

bigbird9999

New Member
Joined
Aug 15, 2022
Messages
1
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
Good day to You all!

I've "inherited" an Excel file that works rather slowly. It consists of multiple sheets with 30+ columns and ±6000 rows containing VLOOKUPS, XLOOKUPS, etc. in lengthy tables. The file needs to be used by unexperienced people. Their work consists of adding/deleting rows and then pushing a "button" to start VBA-code that copy/paste formulas etc.

The recalculation nowadays takes about 15 seconds. Not a pleasant user experience... I would like to minimize the time needed for recalculation. In my quest on the Interwebs I've encountered the command:

VBA Code:
Sheets("Sheet1").Range("A1:A10").Calculate

It looks like a viable solution for the issue, but I can not discover if the code bypasses a complete recalculation or not. The current code uses the
Code:
Application.Calculation= xlManual/xlAutomatic
method.

Eternal Kudo's for the person(s) that can shed some light on this subject!

Grtz,
Bert.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Good day to You all!

I've "inherited" an Excel file that works rather slowly. It consists of multiple sheets with 30+ columns and ±6000 rows containing VLOOKUPS, XLOOKUPS, etc. in lengthy tables. The file needs to be used by unexperienced people. Their work consists of adding/deleting rows and then pushing a "button" to start VBA-code that copy/paste formulas etc.

The recalculation nowadays takes about 15 seconds. Not a pleasant user experience... I would like to minimize the time needed for recalculation. In my quest on the Interwebs I've encountered the command:

VBA Code:
Sheets("Sheet1").Range("A1:A10").Calculate

It looks like a viable solution for the issue, but I can not discover if the code bypasses a complete recalculation or not. The current code uses the
Code:
Application.Calculation= xlManual/xlAutomatic
method.

Eternal Kudo's for the person(s) that can shed some light on this subject!

Grtz,
Bert.
Hello Bigbird,

I hope that this helps.

If manual calculation is set then excel will not re-calculate anything unless you manually do it (Press F9; or via a macro.) If automatic calculation is set then excel will re-calculate every time any data changes.
VBA Code:
Sub ManualCalc()
    Application.Calculation = manual
End Sub

If you add:-

Application.ScreenUpdating = False

At the start of the VBA code to calculate everything and:-

Application.ScreenUpdating = True

at the end; it will calculate faster.

VBA Code:
Sub QuickCalc()
Application.Calculation = manual   ' sets to manual calculation:- if it is set to xlautomatic
Application.ScreenUpdating = False
Calculate
                                              'Then do the copy and paste VBA code
Application.ScreenUpdating = True
End Sub


*** You can set it Excel to always change the calculation to manual when the file is opened.
By opening VBA editor Alt-F11.
Open the 'ThisWorkbook' code from the left-hand selection window.
then paste the code below.

VBA Code:
Option Explicit
Private Sub Workbook_Open()
    Application.Calculation = xlManual
End Sub

***

Now when the file is opened Excel is set as manual calculation.

Jamie McMillan
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top