title: Why won't VBA array with in ArrayList ReDim inside a subrotine and preserve the scope?
body: <p>I am changing the size of the array inside an array list using ReDim in separate subroutine. But the array size isn't changing in the main subroutine. I am using ByRef. findItem checks if any items in one array exists in another array. The print out in the console is</p>
  <pre><code>In Change Array Size: 12
  In combine Array Size: 6
  In Change Array Size: 14
  In combine Array Size: 7
  </code></pre>
  <p>Here is my code</p>
  <pre><code>Sub combineCRMITN(ByRef assocMap As Object, TN As Object, crmitnAbort As Date)
      Dim assocRow As Long, tnRow As Variant, assocSize As Long, TnStrCount As Long, assocSizeNew As Long, wholeSize As Long
      For assocRow = 0 To assocMap.Count - 1
          For Each tnRow In TN
              If findItem(assocMap.Item(assocRow), tnRow) Then
                  TnStrCount = CountString(tnRow)
                  assocSize = UBound(assocMap.Item(assocRow))
                  Call changeSize(assocMap.Item(assocRow), assocSize)
                  Debug.Print (&quot;In combine Array Size: &quot; &amp; UBound(assocMap.Item(assocRow)))
                  Exit For
              End If
          Next tnRow
          If Now &gt; crmitnAbort Then Exit For
      Next assocRow
  End Sub
  
  Sub changeSize(ByRef theArray As Variant, newArrSize As Long)
      Dim theArraySize As Long
      theArraySize = UBound(theArray)
      ReDim theArray(theArraySize + newArrSize)
      Debug.Print (&quot;In Change Array Size: &quot; &amp; UBound(theArray))
  End Sub
  
  Function findItem(arrRow1 As Variant, arrRow2 As Variant) As Boolean
      Dim arr1Size As Long, arr1ind As Long
      arr1Size = UBound(arrRow1)
      For arr1ind = 0 To arr1Size
          If IsIn(VarType(arrRow1(arr1ind)), &quot;2,3,4,5&quot;) Then
              If IsInArray(CLng(arrRow1(arr1ind)), arrRow2) Then
                  findItem = True
                  Exit Function
              End If
          End If
      Next arr1ind
      findItem = False
  End Function
  </code></pre>
  <p>The end result is the array size will change in the main function combineCRMITN.</p>