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 is named and saved.

Accessors

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 of 55 and 60.


Worksheets("options").Scenarios.Add name:="Typical", _
    changingCells:=Worksheets("options").Range("A2,A12"), _
    values:=Array("55", "60")

Use the Scenarios method with an argument to access a single member of the collection or without an argument to access the entire collection at once. 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")

Properties

Application Property, Count Property, Creator Property, Parent Property.

Methods

Add Method (Scenarios Collection), CreateSummary Method, Item Method, Merge Method.