# C1.WPF.Excel.XLNamedRangeCollection.Add

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_Excel_XLNamedRangeCollection_Add_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add*">Add Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_Excel_XLNamedRangeCollection_Add_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add*"></a>
<h4 id="C1_WPF_Excel_XLNamedRangeCollection_Add_C1_WPF_Excel_XLNamedRange_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add(C1.WPF.Excel.XLNamedRange)">Add(XLNamedRange)</h4>
<div class="markdown level1 summary"><p>Appends an <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object to the collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public XLNamedRange Add(XLNamedRange namedRange)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Add(namedRange As XLNamedRange) As XLNamedRange</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="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a></td>
      <td><span class="parametername">namedRange</span></td>
      <td><p>The <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object to add to the collection.</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="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a></td>
      <td><p>A reference to the object if it was successfully added to the collection,
or null if the object could not be added (usually because it
overlaps another cell range already in the collection).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_WPF_Excel_XLNamedRangeCollection_Add_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add*"></a>
<h4 id="C1_WPF_Excel_XLNamedRangeCollection_Add_System_String_C1_WPF_Excel_XLCellRange_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add(System.String,C1.WPF.Excel.XLCellRange)">Add(string, XLCellRange)</h4>
<div class="markdown level1 summary"><p>Creates an <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object and appends it to the collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public XLNamedRange Add(string name, XLCellRange cellRange)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Add(name As String, cellRange As XLCellRange) As XLNamedRange</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 name of the named range to create.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.WPF.Excel.XLCellRange.html">XLCellRange</a></td>
      <td><span class="parametername">cellRange</span></td>
      <td><p>The <a class="xref" href="C1.WPF.Excel.XLCellRange.html">XLCellRange</a> to include in the named range.</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="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a></td>
      <td><p>A reference to the object if it was successfully added to the collection,
or null if the object could not be added (usually because it
overlaps another cell range already in the collection).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_WPF_Excel_XLNamedRangeCollection_Add_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add*"></a>
<h4 id="C1_WPF_Excel_XLNamedRangeCollection_Add_System_String_C1_WPF_Excel_XLCellRange___" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add(System.String,C1.WPF.Excel.XLCellRange[])">Add(string, XLCellRange[])</h4>
<div class="markdown level1 summary"><p>Creates an <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object and appends it to the collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public XLNamedRange Add(string name, XLCellRange[] cellRanges)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Add(name As String, cellRanges As XLCellRange()) As XLNamedRange</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 name of the named range to create.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.WPF.Excel.XLCellRange.html">XLCellRange</a>[]</td>
      <td><span class="parametername">cellRanges</span></td>
      <td><p>The array of <a class="xref" href="C1.WPF.Excel.XLCellRange.html">XLCellRange</a> to include in the named range.</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="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a></td>
      <td><p>A reference to the object if it was successfully added to the collection,
or null if the object could not be added (usually because it
overlaps another cell range already in the collection).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_WPF_Excel_XLNamedRangeCollection_Add_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add*"></a>
<h4 id="C1_WPF_Excel_XLNamedRangeCollection_Add_System_String_C1_WPF_Excel_XLSheet_System_Int32_System_Int32_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add(System.String,C1.WPF.Excel.XLSheet,System.Int32,System.Int32)">Add(string, XLSheet, int, int)</h4>
<div class="markdown level1 summary"><p>Creates an <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object and appends it to the collection.
This overload creates a range containing a single cell.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public XLNamedRange Add(string name, XLSheet sheet, int rowIndex, int colIndex)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Add(name As String, sheet As XLSheet, rowIndex As Integer, colIndex As Integer) As XLNamedRange</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 name of <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.WPF.Excel.XLSheet.html">XLSheet</a></td>
      <td><span class="parametername">sheet</span></td>
      <td><p>The worksheet the range belongs to.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowIndex</span></td>
      <td><p>The row index of the cell in the range.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">colIndex</span></td>
      <td><p>The column index of the cell in the range.</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="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a></td>
      <td><p>A reference to the object if it was successfully added to the collection,
or null if the object could not be added (usually because it
overlaps another cell range already in the collection).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_WPF_Excel_XLNamedRangeCollection_Add_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add*"></a>
<h4 id="C1_WPF_Excel_XLNamedRangeCollection_Add_System_String_System_Int32_System_Int32_System_Int32_System_Int32_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add(System.String,System.Int32,System.Int32,System.Int32,System.Int32)">Add(string, int, int, int, int)</h4>
<div class="markdown level1 summary"><p>Creates an <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object and appends it to the collection.
This overload allows you to create a 3-D reference to the same range of cells on multiple worksheets.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public XLNamedRange Add(string name, int firstSheetIndex, int lastSheetIndex, int rowIndex, int colIndex)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Add(name As String, firstSheetIndex As Integer, lastSheetIndex As Integer, rowIndex As Integer, colIndex As Integer) As XLNamedRange</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 name of <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">firstSheetIndex</span></td>
      <td><p>The index of the first <a class="xref" href="C1.WPF.Excel.XLSheet.html">XLSheet</a> to include.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">lastSheetIndex</span></td>
      <td><p>The index of the last <a class="xref" href="C1.WPF.Excel.XLSheet.html">XLSheet</a> to include.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowIndex</span></td>
      <td><p>The index of the top row in the cell range.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">colIndex</span></td>
      <td><p>The index of the left column in the cell range.</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="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a></td>
      <td><p>A reference to the object if it was successfully added to the collection,
or null if the object could not be added (usually because it
overlaps another cell range already in the collection).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_WPF_Excel_XLNamedRangeCollection_Add_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add*"></a>
<h4 id="C1_WPF_Excel_XLNamedRangeCollection_Add_System_String_C1_WPF_Excel_XLSheet_System_Int32_System_Int32_System_Int32_System_Int32_" data-uid="C1.WPF.Excel.XLNamedRangeCollection.Add(System.String,C1.WPF.Excel.XLSheet,System.Int32,System.Int32,System.Int32,System.Int32)">Add(string, XLSheet, int, int, int, int)</h4>
<div class="markdown level1 summary"><p>Creates an <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object and appends it to the collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public XLNamedRange Add(string name, XLSheet sheet, int rowIndex, int colIndex, int rowCount, int colCount)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Add(name As String, sheet As XLSheet, rowIndex As Integer, colIndex As Integer, rowCount As Integer, colCount As Integer) As XLNamedRange</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 name of <a class="xref" href="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a> object.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.WPF.Excel.XLSheet.html">XLSheet</a></td>
      <td><span class="parametername">sheet</span></td>
      <td><p>The worksheet containing the range.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowIndex</span></td>
      <td><p>The index of the top row in the cell range.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">colIndex</span></td>
      <td><p>The index of the left column in the cell range.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowCount</span></td>
      <td><p>The number of rows in the cell range.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">colCount</span></td>
      <td><p>The number of columns in the cell range.</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="C1.WPF.Excel.XLNamedRange.html">XLNamedRange</a></td>
      <td><p>A reference to the object if it was successfully added to the collection,
or null if the object could not be added (usually because it
overlaps another cell range already in the collection).</p>
</td>
    </tr>
  </tbody>
</table>
</div>
