A destroying the old values by using the Preserve keyword : Dynamic Array « Date Functions « VBA / Excel / Access / Word






A destroying the old values by using the Preserve keyword

 
Sub redimDemo()
    Dim MyArray() As Integer
    ReDim MyArray(12)
    ReDim Preserve MyArray(12)
End Sub

 








Related examples in the same category

1.Dynamic Arrays
2.Declaring and Working with Dynamic Arrays
3.Use ReDim to create dynamic array
4.Using a Dynamic Array
5.There's a potential problem when you try to resize the array:
6.Use the Preserve keyword to keep the values
7.Transpose() sub procedure is using a dynamic array that is re-dimensioned with two dimensions.