Class Scenario (Excel VBA)

The class Scenario represents a scenario on a worksheet.

Member in collection

For Each

Here is an example of processing the Scenario items in a collection.

Dim scns As Scenarios: Set scns = 
For Each scn In scns.Merge Source:=
	With scn
	End With
Next scn

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

Delete - Deletes the object.

Show - Shows the scenario by inserting its values on the worksheet. The affected cells are the changing cells of the scenario.

Scenarios.Add - Creates a new scenario and adds it to the list of scenarios that are available for the current worksheet.

Scenarios.CreateSummary - Creates a new worksheet that contains a summary report for the scenarios on the specified worksheet.

Scenarios.Item - Returns a single object from a collection.

Scenarios.Merge - Merges the scenarios from another sheet into the Scenarios collection.


ChangingCells returns a Range object that represents the changing cells for a scenario.

Comment returns or sets a String value that represents the comment associated with the scenario.

Hidden returns or sets a Boolean value that indicates if the scenario is hidden.

Index returns a Long value that represents the index number of the object within the collection of similar objects.

Locked returns or sets a Boolean value that indicates if the object is locked.

Name returns or sets a String value representing the name of the object.

Values returns a Variant array that contains the current values of the changing cells for the scenario.

Scenarios.Count returns a Long value that represents the number of objects in the collection.

Range - Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3D range.