title: How to redim Arrays in VBA
body: <p>I have repetitive snippets of code that increases the size of dynamic arrays when needed so prefer them in a subroutine. I have been googling for half a day and cannot seem to find a solution to redim an array in another routine. Found a solution but that was for an early 2000s version of VBA and doesn't work with this Excel 2013 version.</p>
  
  <p><code>reDim</code> only <code>reDim</code> the size of theArray but not the actual <code>arrGrp</code> which should have been passed by reference. I am using Excel 2013. Any solution on how to <code>reDim</code> an array passed <code>byRef</code>?</p>
  
  <pre><code>Sub ArraySizeUp(ByRef theArray) 'theArray() doesn't work also
  
      'increment size by 1
      If ArrayIsAllocated(theArray) Then
          ReDim Preserve theArray(UBound(theArray) + 1)
      Else
          ReDim theArray(0)
      End If
  
  End Sub
  </code></pre>
  
  <p>-</p>
  
  <pre><code>Sub Main()
  
      Dim arrGrp()
  
      ArraySizeUp arrGrp
      'Call ArraySizeUp(arrGrp) - doesnt work as well
  
  End Sub
  </code></pre>