Scenarios object (Excel)
A collection of all the Scenario objects on the specified worksheet.
Remarks
A scenario is a group of input values (called changing cells) that's named and saved.
Example
Use the Scenarios method of the Worksheet object to return the Scenarios collection.
The following example creates a summary for the scenarios on the worksheet named Options by using cells J10 and J20 as the result cells.
Worksheets("options").Scenarios.CreateSummary _
resultCells:=Worksheets("options").Range("j10,j20")
Use the Add method to create a new scenario and add it to the collection. The following example adds a new scenario named Typical to the worksheet named Options. The new scenario has two changing cells, A2 and A12, with the respective values 55 and 60.
Worksheets("options").Scenarios.Add name:="Typical", _
changingCells:=Worksheets("options").Range("A2,A12"), _
values:=Array("55", "60")
Use Scenarios (index), where index is the scenario name or index number, to return a single Scenario object. The following example shows the scenario named Typical on the worksheet named Options.
Worksheets("options").Scenarios("typical").Show
Methods
Properties
See also
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.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기