Microsoft Office Tutorials and References

In Depth Information

**16.1.5 Calculation-Related Members**

If you want to clear a previously set OnTime macro, you can call the procedure with the

Schedule
parameter set to
False
. Otherwise, the parameter can be omitted, since its default

value is
True
.

Note that the
Now
function returns the current time. Thus, to schedule a macro for a certain

amount of time from the present, we can set
EarliestTime
to:

Now + TimeValue(
time
)

16.1.5 Calculation-Related Members

The Application object has several members related to calculation.

16.1.5.1 Calculate method

This method calculates all open workbooks, a specific worksheet in a workbook, or a specified

range of cells on a worksheet, depending upon how it is applied.

When applied to the Application object, as in:

Application.Calculate

Excel will calculate all open workbooks. When applied to a specific worksheet, as in:

Worksheets(1).Calculate

Excel will calculate that worksheet. When applied to a specific range, as in:

Worksheets(1).Rows(2).Calculate

Excel will calculate the cells in that range. Note that since Calculate is a global method, we can

simply write:

Calculate

in place of:

Application.Calculate

16.1.5.2 CalculateFullRebuild method

This method calculates all data and rebuilds all dependencies (formulas that refer to other cells) in

all open workbooks. This method applies only to the Application object.

16.1.5.3 Calculation property (R/W Long)

This property sets Excel's calculation mode and can be set to any of the following constants:

Enum XlCalculation

xlCalculationManual = -4135

xlCalculationAutomatic = -4105

xlCalculationSemiautomatic = 2

End Enum