LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Using Redim on 2 dimensional array

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Redimming an array dynamically assigned from range (how to redim first dimension of a 2-D array? /or/ reverse the original array order) Keith R[_2_] Excel Programming 3 November 13th 07 04:08 PM
Export 1-dimensional array values to a two-dimensional table? Laurie Excel Programming 2 November 8th 07 03:51 PM
Changing a two-dimensional, one row array to one-dimensional Alan Beban[_2_] Excel Programming 1 September 16th 07 08:56 PM
ReDim Object array as parameter of Variant array Peter T Excel Programming 4 May 10th 05 02:11 PM
Create One-Dimensional Array from Two-Dimensional Array Stratuser Excel Programming 1 February 23rd 05 08:46 PM


All times are GMT +1. The time now is 12:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"