Automatic Calculation

melewie

Board Regular
Joined
Nov 21, 2008
Messages
188
Office Version
  1. 365
Platform
  1. Windows
Hi All,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
I am having problems with returning a workbook to automatic calculation, I am using the below code<o:p></o:p>
<o:p></o:p>
Code:
[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Application.Calculation = xlManual<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Lots of code<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Application.Calculation = xlCalculationAutomatic<o:p></o:p>[/FONT][/COLOR]
<o:p></o:p>
<o:p></o:p>
I have stepped through the code and it is definitely reading the code but not changing the WB back to auto calculation. I am fully stuck with this and any help would be greatly appreciated.<o:p></o:p>
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Code:
    Application.Calculation = xlManual

        Lots of code

    Application.Calculation = xlAutomatic    <-------------
 
Upvote 0
I think it should be

Application.Calculation = xlCalculationManual

and then

**

Application.Calculation = xlCalculationAutomatic

Do you have

application.screenupdating = true
application.enableevents = true

at the asterisks
 
Upvote 0
I have treid 'xlAutomatic' and still doesnt change calculation to auto.

Code:
Application.ScreenUpdating = False 
Application.Calculation = xlManual 
 
Lots of Code
 
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic

I am also using screen updating and this is working fine i am using excel 2007 if that makes any diffrence :confused::confused:
 
Upvote 0
xlAutomatic is definately correct. i use it regularly.

is there any chance the code is quitting early and not getting far enough. have you stepped through it? (F8)
 
Upvote 0
sorry i see you have stepped.

have you changed workbooks in the code (eg copy and paste and reselected)
 
Upvote 0
My guess would be the code isn't executing (or maybe some other code responding eg to an event is disabling the calculation).

xlAutomatic = xlCalculationAutomatic

xlManual = xlCalculationManual
 
Upvote 0
I use it on 99% of my code and have never had a problem with it (until now) yes I have stepped through the code and it is being read I have put code after it and that works even tried putting it within an IF
ie
if calc = man then
calc = auto
end if

(obviously with the correct code not the jibberish above)

it goes through it fine it just doesnt seem to work?!?!?! I am really confussed which is bad for a monday morning:biggrin:
 
Upvote 0
sorry i see you have stepped.

have you changed workbooks in the code (eg copy and paste and reselected)

yes I have changed workbooks to copy and paste. I start on WB1 go to WB2 copy from WB2 and paste in WB1 so I have WB1 selected at the start and end. does this make a diffrence?
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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