VBA ReDim Statement

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

The Excel VBA ReDim statement initializes and resizes a dynamic VBA Array. Be sure to check the difference between Fixed VBA Arrays and Dynamic VBA Arrays.

VBA ReDim Statement Syntax

Parameters

Preserve
Optional. Keyword to be used if you want to resize your array and keep all items intact.
varname
The name of the array variable.
subscripts
The subscripts of the array defining either it’s upper bounds or lower and upper bounds. See examples below.

Using ReDim with single dimension arrays

Below an example of sizing and resizing a VBA Array:

Using ReDim to resize an array but preserving its contents

Below an example of sizing and resizing a VBA Array, but keeping its contents preserved:

Using ReDim with multidimensional arrays

Below an example of sizing and resizing a multidimensional array:

Simply the best place to learn Excel VBA