[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IScenario.ChangeScenario

ChangeScenario Method

ChangeScenario(IRange, List<object>)

Changes the scenario to have a new set of changing cells and scenario values.

The values correspond to the cells in changingCells one by one. For example, if changingCells is "B2:C3", the values should be supplied in the order B2, C2, B3, and C3. If values is null, the current values in changingCells are used for the scenario.

Declaration
void ChangeScenario(IRange changingCells, List<object> values = null)
Sub ChangeScenario(changingCells As IRange, Optional values As List(Of Object) = Nothing)
Parameters
Type Name Description
IRange changingCells

An IRange object that refers to the changing cells for the scenario.

List<object> values

A list that contains the scenario values for the cells in ChangingCells. The values should be provided in the same order as the cells in changingCells; null uses the current values in those cells.

Examples
List<object> values = new List<object> { 0.05, 0.04, 0.03, 0.02, 0.05 };
IScenario scenario = worksheet.Scenarios.Add(
    "Less Discount Rates", worksheet.Range["D2:D6"], values);
scenario.ChangeScenario(worksheet.Range["D2:D6"],
    new List<object> { 0.05, 0.06, 0.03, 0.02, 0.05 });