Calculate a range always and calculate another range manually, on-demand (same sheet)

yflpov

New Member
Joined
Jan 21, 2023
Messages
2
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hi all,

I'm looking for a solution for making the range D3:D53 calculate always and for making the range G4:G53 calculate only on-demand (and apply AutoFit Row Height) via a button. This is an enhancement from having the entire G column calculate on-demand and keeping the calculation for the sheet disabled otherwise.

My current setup is to apply:
VBA Code:
ThisWorkbook.Sheets("Timeline").EnableCalculation = False
at Activate and Deactivate the sheet (to make sure no calculation is happening unless I really want it) and apply:
VBA Code:
ThisWorkbook.Sheets("Timeline").EnableCalculation = False
ThisWorkbook.Sheets("Timeline").EnableCalculation = True
Columns("G:G").Select
Selection.Rows.AutoFit
Range("B1").Activate
ThisWorkbook.Sheets("Timeline").EnableCalculation = False
via a button when I want to have the formulas in column G recalculated.

The code I've tried is:
VBA Code:
Application.Calculation = xlManual
Range("D3:D53").Calculate
at Activate and Deactivate the sheet and apply:
VBA Code:
Application.Calculation = xlManual
Columns("G:G").Select
Selection.Rows.AutoFit
Range("B1").Activate
Range("G4:G53").Calculate
Range("D3:D53").Calculate
via a button when I want to have the formulas in G4:G53 recalculated.

This solution gets me what I want from the sheet but the entire workbook remains in Manual calculation mode which I don't want.

I tried adding
VBA Code:
Application.Calculation = xlAutomatic
at the end of the Active/Deactivate code and at my button code but it started working against having G4:G53 calculate only on-demand.

I realise the code is not optimised and there are redundancies. Honestly, I'm not terribly experienced with VBA and would rather have those dependencies there for the sake of ensuring proper function. Feel free to add/remove/edit as you see fit.

Thanks to all who try and help!

Best!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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