Solved

prevent calculation from turning off

Posted on 2013-11-15
2
211 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

809 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