title: Declaring multiple ranges with changing integer n
body: <p>My worksheet has multiple tables/listobjects. I am trying to select one table at a time (in successive view order not by table number, as there may be tables that were inserted in between already existing tables at some point). The tables are to be selected, converted to a range, then that range to be declared/set for future use. I cannot figure out how to do so because ranges have to be declared with a constant and not a variable. Here is my code thus far:</p>
  
  <pre><code>Dim LastRow As Long, c As Range
  LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).row
  Dim n As Integer
  n = 1
  Dim tableName As String
  Dim SelectedCell As Range
  
  For Each c In Range("B6:B" &amp; LastRow)
      If c.Text = "Column1" Then
          c.Activate
          Set SelectedCell = ActiveCell
          tableName = SelectedCell.ListObject.Name
          ActiveSheet.ListObjects(tableName).Range.Select
          ActiveSheet.ListObjects(tableName).Unlist
          Dim rng(n) As Range
          Set rng(n) = Selection
          n = n + 1
      End If
  Next
  </code></pre>