# GrapeCity.Documents.Excel.IScenarios.Add

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Excel_IScenarios_Add_" data-uid="GrapeCity.Documents.Excel.IScenarios.Add*">Add Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Excel_IScenarios_Add_" data-uid="GrapeCity.Documents.Excel.IScenarios.Add*"></a>
<h4 id="GrapeCity_Documents_Excel_IScenarios_Add_System_String_GrapeCity_Documents_Excel_IRange_System_Collections_Generic_List_System_Object__System_String_System_Boolean_System_Boolean_" data-uid="GrapeCity.Documents.Excel.IScenarios.Add(System.String,GrapeCity.Documents.Excel.IRange,System.Collections.Generic.List{System.Object},System.String,System.Boolean,System.Boolean)">Add(string, IRange, List&lt;object&gt;, string, bool, bool)</h4>
<div class="markdown level1 summary"><p>Creates a new scenario and adds it to the list of scenarios in the current worksheet.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">IScenario Add(string name, IRange changingCells, List&lt;object&gt; values = null, string comment = null, bool locked = true, bool hidden = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function Add(name As String, changingCells As IRange, Optional values As List(Of Object) = Nothing, Optional comment As String = Nothing, Optional locked As Boolean = True, Optional hidden As Boolean = False) As IScenario</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>The scenario name.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Excel.IRange.html">IRange</a></td>
      <td><span class="parametername">changingCells</span></td>
      <td><p>A Range object that refers to the changing cells for the scenario.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a>&gt;</td>
      <td><span class="parametername">values</span></td>
      <td><p>A list that contains the scenario values for the cells in ChangingCells. If this argument is omitted, the scenario values are assumed to be the current values in the cells in ChangingCells.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">comment</span></td>
      <td><p>A string that specifies comment text for the scenario. If this argument is omitted, the author's name(Document Solutions for Excel) and date are automatically added as the comment text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">locked</span></td>
      <td><p>True to lock the scenario to prevent changes. The default value is True.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">hidden</span></td>
      <td><p>True to hide the scenario. The default value is False.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Excel.IScenario.html">IScenario</a></td>
      <td><p>Returns the new <a class="xref" href="GrapeCity.Documents.Excel.IScenario.html">IScenario</a> object.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
