Scenarios Method

Microsoft Excel Visual Basic

Returns an object that represents either a single scenario (a Scenario object) or a collection of scenarios (a Scenarios object) on the worksheet.

expression.Scenarios(Index)

expression    Required. An expression that returns a Worksheet object.

Index    Optional Variant. The name or number of the scenario. Use an array to specify more than one scenario.

Example

This example sets the comment for the first scenario on Sheet1.

Worksheets("Sheet1").Scenarios(1).Comment = _
    "Worst-case July 1993 sales"