ChangeScenario Method

Applies To

Scenario Object.

Description

Changes the scenario to have a new set of changing cells and (optionally) scenario values.

Syntax

object.ChangeScenario(changingCells, values)

object

Required. The Scenario object.

changingCells

Required. A Range that specifies the new set of changing cells for the scenario. The changing cells must be on the same sheet as the scenario.

values

Optional. An array containing the new scenario values for the changing cells. If omitted, the scenario values are assumed to be the current values in the changing cells.

Remarks

If you specify values, the array must contain an element for each cell in the changingCells range, or Microsoft Excel generates an error.

See Also

ChangingCells Property, Comment Property.

Example

This example sets the changing cells for scenario one to the range A1:A10 on Sheet1.


Worksheets("Sheet1").Scenarios(1).ChangeScenario _
    Worksheets("Sheet1").Range("A1:A10")