CitectVBA Programming Reference > CitectVBA Function Reference > Declarations > ReDim

ReDim

Used to size or resize a dynamic array that has already been declared using the Dim statement with empty parentheses.

Use the ReDim statement to change the number of elements in an array, but not to change the number of dimensions in an array or the type of the elements in the array.

Syntax

ReDimVariableName(Subscripts)

VariableName:

The name of the variable or array being redimensioned.

Subscripts:

An Integer or expression representing a valid To numeric value range when declaring the dimensions of an variable array. Up to 60 multiple dimensions may be declared.

The subscripts argument uses the following syntax:

[lower To] upper [,[lower To] upper] . . .

When not explicitly stated in lower, the lower bound of an array is controlled by the Option Base statement. The lower bound is zero if no Option Base statement is present in the CitectVBA file.

Related Functions

Dim | Const | Static

Example

Dim TestArray() As Integer
Dim I
ReDim TestArray(10)
For I = 1 To 10
TestArray(I) = I + 10
Print TestArray(I)
Next I