Worksheet.Scenarios method (Excel)

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.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.