Worksheet.Scenarios Method

Excel Developer Reference

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

Syntax

expression.Scenarios(Index)

expression   A variable that represents a Worksheet object.

Parameters

Name Required/Optional Data Type Description
Index Optional Variant The name or number of the scenario. Use an array to specify more than one scenario.

Return Value
Object

Example

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

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

See Also