title: Check if Named Range is equal to another Named Range
body: <p>I’m trying to resize a Named Range in Excel if the Named Range “InventoryList” is equal to the Named Range passed into the Sub. I can’t seem to get the correct syntax for this. The &quot;IF&quot; statement is where I'm getting the error. Hopefully someone can help me out.</p>
  <p>Thanks in advance.</p>
  <pre><code>    Sub Resize_Inventory_Range(InventoryList As Excel.Range)
  
          Dim xlApp As Excel.Application
          Dim WB As Excel.Workbook
          Dim WS As Excel.Worksheet
          Dim FullInventory As Excel.Range
  
          xlApp = GetObject(, Constants.ExcelApp)
          WB = xlApp.Workbooks(&quot;Product&quot;)
          WS = WB.Sheets(&quot;Inventory&quot;)
          FullInventory = WS.Range(&quot;Full_Inventory&quot;)
  
          If InventoryList.Name.Name = &quot;Hardware_Inventory&quot; Then
              FullInventory.Resize(FullInventory.Rows.Count + 1, 4).Name = FullInventory.Name.Name
          End If
  
      End Sub
  </code></pre>