title: Subscript out of range when filling data in string array
body: <p>I'm trying to store some reference data in a string array and then use that later on to compare with another string array. However, the code is not working since I'm getting a "subscript out of range" error (see code comment below). </p>
  
  <pre><code>Sub StoreBaseReferences()
      Dim cell As Range
      Dim val As Variant
      Dim stringValues() As String
      Dim i, rowCounter, columnCounter As Integer
  
      rowCounter = 0
      columnCounter = 0
      For i = 2 To Sheets("sheet").UsedRange.rows.Count
  
          For Each cell In Range(Cells(i, 2), Cells(i, 4))
              stringValues(rowCounter, columnCounter) = cell.Value 'this is throwing the subscript ouf of range error
              columnCounter = columnCounter + 1
          Next cell
  
          rowCounter = rowCounter + 1
          columnCounter = 0
      Next i
      MsgBox (stringValues(0, 0))
  
  
  End Sub
  </code></pre>
  
  <p>What is missing here?</p>