Thread
:
Using Redim on 2 dimensional array
View Single Post
#
2
Posted to microsoft.public.excel.programming
Nigel[_2_]
external usenet poster
Posts: 735
Using Redim on 2 dimensional array
Using Preserve prevents you from changing any dimension other than the last.
Dim myArray(5,5)
can be resized
ReDim Preserve myArray(5,10)
but not
ReDim Preserve myArray(10,5)
HTH
--
Regards,
Nigel
"RocketRod" wrote in message
...
I am having trouble trying to use ReDim on a 2 dimensional array.
I need to increase the size of the array in a For€¦Next loop as data is
determined as valid - it is a staff list by name with 3 additional
columns
of data for each name but the number of staff that will populate the array
is
not known at the start, hence the Array needs to start as a 1x4, then
change
to 2x4 etc
I have tried using both types of Dim statements as follows based on some
of
the forum references
Dim StaffArray()
and
Dim StaffArray() €˜apparently this allows both dimensions of the
array to be modified in the ReDim
with each of the following types of ReDim (obviously only one at a time)
Dim staffindex as Integer
€¦
For€¦€¦.€¦
ReDim Preserve StaffArray(5, 4)
ReDim Preserve StaffArray(staffindex, 4)
ReDim Preserve StaffArray(staffindex To 5, 4)
ReDim Preserve StaffArray(staffindex To 5, 4 To 4)
Next€¦
Can some give me the right combination of Dim and ReDim please - I keep
getting subscript out of range errors
Reply With Quote
Nigel[_2_]
View Public Profile
Find all posts by Nigel[_2_]