Purpose
Changes the number of elements in an array.
Using this command on an existing array will replace the old array dimension with the new one.
Syntax
ReDim VarName As VarType
ReDim Preserve VarName As VarType
ReDim VarName (ArrayUpperBound) As VarType
ReDim VarName (ArrayLowerBound To ArrayUpperBound) As VarType
ReDim VarName1 As VarType, Varname2 As VarType...
Preserve |
Keeps existing values in an array. If you don't include this keyword, the array is erased as if Erase had been used on it. |
For an explanation of the rest of this syntax, see Dim.
Example
ReDim Preserve MyArray (MAXVAL+1) As Integer
|