I have a Range array declared
Dim aRange(1 to 5) as Range
I am unable to resize the array later on in my code using
ReDim Preserve aRange(1 to a)
Is there something I am doing wrong or am I unable to resize a Range array.
Change:
Dim aRange(1 to 5) as Range 'Static dimensioning, cannot be changed later on
by:
Dim aRange() as Range 'Declared as dynamic array, have to be redim before using it
So:
Dim a as Integer
a = 6
Dim aRange() as Range 'Declared as dynamic array, have to be redim before using it
ReDim Preserve aRange(1 to 5)
ReDim Preserve aRange(1 to a)
See ReDim Statement