Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multidimensional array slowing down 1

Status
Not open for further replies.

UnsolvedCoding

Technical User
Jul 20, 2011
424
US
I am trying to run a multi-dimensional array but the array keeps slowing down as it goes.

The data is thirteen columns wide and about 15,000 rows deep. The array will pick up the info but the longer it goes the slower it gets.

My computer has a lot of memory available and the info is off a worksheet in Excel that is copied over from three different worksheet at a prior point in the code, so I am a bit baffled as to why the array is slowing down. The copy and past happens quickly and there are no delays when it happens.

Does anyone know why the array would progressivly slow down and why its not realistic to use after about 750 rows of info have been put into the array?
 
can you post the code? Are you Redim the array?

Redim Preserve in a large array can cause you some major performance issues. Without seeing the code you may want to consider this concept. Declare the array redim it once to the range redim preserve after its populated to resize the array to actual data

Thoughts?

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
Are you assigning the data to/from the worksheet from/to the array one cell at a time, or in a single step? The latter is a lot faster.

Please post your code.

Tony
 
The internet hookup at work is super slow becaue of massive processing going on right now so I don't know if posting the code will happen or not.

The way it is set up is as a redim preserve and the row count is done before, so it reads something like this -

Redim Preserve Myarray(Row_Count, A)

Myarray(1, A) = worksheet("Sheet1").range("A" & i).value
Myarray(2,A) = worksheet("Sheet1").range("B" & i).value

 
What about this ?
Code:
Dim myArray
myArray = Worksheet("Sheet1").Range("A1:B" & Row_Count).Value
In a single instruction you get an array like Cells.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Will that put the information back into the correct number of columns?
 
I was finally able to get this plugged into the program to test it and it works like a dream!

THANKS PHV!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top