How to: Programmatically Run Excel Calculations Programmatically

 

You use a similar process to run calculations in a NamedRange control or a native Excel range object.

Applies to: The information in this topic applies to document-level projects and VSTO add-in projects for Excel. For more information, see Features Available by Office Application and Project Type.

The following example creates a NamedRange at cell A1 and then calculates the cell. This code must be placed in a sheet class, not in the ThisWorkbook class.

To run calculations in a NamedRange control

  1. Create the named range.

    No code example is currently available or this language may not be supported.

  2. Call the Calculate method of the specified range.

    No code example is currently available or this language may not be supported.

To run calculations in a native Excel Range

  1. Create the named range.

    No code example is currently available or this language may not be supported.

  2. Call the Range.Calculate method of the specified range.

    No code example is currently available or this language may not be supported.

Working with Ranges
NamedRange Control
Optional Parameters in Office Solutions

Show: