title: Populating VBA dynamic arrays
body: <p>The following code gives me error 9 "subscript out of range". I meant to declare a dynamic array so that the dimension changes as I add elements to it. Do I have to create a "spot" on the array before I store something in it like in JS?</p>
  
  <pre><code>Sub test_array()
      Dim test() As Integer
      Dim i As Integer
      For i = 0 To 3
          test(i) = 3 + i
      Next i
  End Sub
  </code></pre>