Scenarios Collection Object

Description

A collection of all the Scenario objects on the specified worksheet. A scenario is a group of input values (called changing cells) that's named and saved.

Using the Scenarios Collection

Use the Scenarios method to return the Scenarios collection. The following example creates a summary for the scenarios on the worksheet named "Options," using cells J10 and J20 as the result cells.

Worksheets("Options").Scenarios.CreateSummary _
    resultCells:=Worksheets("Options").Range("J10,J20")
Use the Add method to create a new scenario and add it to the collection. The following example adds a new scenario named "Typical" to the worksheet named "Options." The new scenario has two changing cells, A2 and A12, with the respective values 55 and 60.

Worksheets("Options").Scenarios.Add name:="Typical", _
    changingCells:=Worksheets("Options").Range("A2,A12"), _
    values:=Array("55", "60")
Use Scenarios(index), where index is the scenario name or index number, to return a single Scenario object. The following example shows the scenario named "Typical" on the worksheet named "Options."

Worksheets("Options").Scenarios("Typical").Show
Properties

Application property, Count property, Creator property, Parent property.

Methods

Add method (Scenarios collection), CreateSummary method, Item method (Scenarios collection), Merge method.