I'm trying out some limitations (according to memory) in Excel (2010, 32bit), somehow Erase Array
doesn't work correctly.
Sub ArrDims()
Dim Arr()
Dim lngC1&, lngC2&
With Sheet1
Arr = .Range(.Cells(1, 1), .Cells(1000000, 20))
For lngC1 = LBound(Arr, 1) To UBound(Arr, 1)
For lngC2 = LBound(Arr, 2) To UBound(Arr, 2)
Arr(lngC1, lngC2) = lngC1 + lngC2
Next lngC2
Next lngC1
End With
With Sheet2
.Cells(2, 2).Resize(UBound(Arr, 1), UBound(Arr, 2)).Value = Arr
.Cells.ClearContents
End With
Erase Arr
End Sub
Starting Excel: approx 23MB of my RAM is used by xl
Execute the sub (with/without) Erase Arr
: approx 210MB of my RAM is used by xl
Another execution of the sub isn't possible due to "Out of memory".
Is there away to delete this allocation?