If you have several Excel files open, and your VBA / VSTO code calls a function Calculateor enables automatic calculation, Excel will painfully recount all open workbooks , not just the active workbook.
This is a well-known and well-known problem that has existed for many years, but Microsoft does not seem to be interested in fixing it.
Calculate only the active book before saving
Microsoft Excel Wish List: Workbook Level Calculation
It's funny, both in VBA and in VSTO, Microsoft gives us the opportunity:
- recount concrete worksheeet
- count all open books
... but there is no way to simply recount one specific Workbook.
The financial company I'm working on is a huge problem. Our actuaries have large, bulky Excel files full of formulas, and when they click Calculate on one workbook or we perform a calculation before saving the file, they have to wait a few minutes so that all other open Excel files can also be calculated.
There are two ways.
You can run some VBA as follows:
Application.Calculation = xlManual
For Each sh In ActiveWorkbook.Worksheets
sh.Calculate
Next sh
.. but this is not guaranteed. Your "Sheet1" may contain formulas that point to cells in "Sheet2", but other cells in "Sheet2" may have dependencies on "Sheet1". Thus, calculating each worksheet once may not be sufficient to complete the calculation in your workbook.
Excel ( ALT Excel). Excel cut'n'pasting, :
"" Excel
, : - ?
Active Excel.
, VBA VSTO, " ", , . . "Workbook.ReadOnly" , .
, , Worksheet_Calculate, , VBA , , ...? , , .
, ...
( Lotus 1-2-3)?