Solved

prevent calculation from turning off

Posted on 2013-11-15
2
210 Views
Last Modified: 2013-11-15
Is there a way to prevent calculation from turning off [or another way of saying the same thing is I need to ensure that calculation remains on at all times]

I am running a macro that does several function that require calculation to be 'on'. Yesterday I discovered that the results were incorrect and when I investigated I discovered that my PC had turned calculation 'off'

is there a simple way to make sure that calculation is always 'ON' in VBA

thanks
0
Comment
Question by:Jagwarman
2 Comments
 
LVL 6

Assisted Solution

by:Michael
Michael earned 250 total points
ID: 39650745
Hi,

one approach is to add the following line to the beginning of your macro:
Application.Calculation = xlCalculationAutomatic

or add this to the ThisWorkbook object to set Calculation to automatic when the workbook is opened:
Private Sub Workbook_Open()
    Application.Calculation = xlCalculationAutomatic
End Sub

Joop
0
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 250 total points
ID: 39650831
Hi,

Just for information...

If you open two (or more) workbooks within the same MS-Excel session (same EXCEL.exe application instance), & one of those workbooks has been saved in an MS-Excel session where the Calculation Mode was set to Manual, then re-saving either workbook will cause this to carry the Manual setting with it when re-opened in any other MS-Excel session.

Consequently, you may find that opening two (or more) workbooks over time results in a majority of your workbooks adopting the Manual Calculation Mode setting; similar to a virus infecting your files!

This functionality is "by design" though.

There is a more detailed explanation here:
[ http://support.microsoft.com/kb/214395 ]

BFN,

fp.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now