Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Breaking up an array into parts

I have an array of strings that is fed into an external function in a
COM. I've found that the code inside has a "break point" where too
many strings suddenly makes it run much slower (memory problem?). If
you call the code with batches of strings it runs much faster.

So how do I do this? I have a "securities(0 to records -1)", and I
want to break that down into chunks of no more than 50 at a time. The
last array cannot have any empty cells at the end.

I thought of using a comma-delimited string of everything in
"securities" and then using Split, but that would always return the
first 50 strings, without some string manipulation anyway.

Maury
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default Breaking up an array into parts

Maury Markowitz wrote:
I have an array of strings that is fed into an external function in a
COM. I've found that the code inside has a "break point" where too
many strings suddenly makes it run much slower (memory problem?). If
you call the code with batches of strings it runs much faster.

So how do I do this? I have a "securities(0 to records -1)", and I
want to break that down into chunks of no more than 50 at a time. The
last array cannot have any empty cells at the end.

I thought of using a comma-delimited string of everything in
"securities" and then using Split, but that would always return the
first 50 strings, without some string manipulation anyway.

Hi Maury,

Set up a couple loops to control the paging. Here's a rough sketch:

'Outer loop
For j = 0 to arraysize\50
PageOffset = j * 50

'Inner loop
For k = 0 to 49
TargetIndex = PageOffset + k
' check to make sure TargetIndex is not past the end of the array
' if ok, add item MyArray(TargetIndex) to the batch
Next k

'Now the batch is built. Call the COM
Next j
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Breaking up an array into parts

So, what is the problem then with passing the first 50 array elements, then
the second 50 array elements etc.,
adjusting for the last lot of elements? You could pass them in a 50 element
array, again adjusting for the last bit.

RBS


"Maury Markowitz" wrote in message
...
I have an array of strings that is fed into an external function in a
COM. I've found that the code inside has a "break point" where too
many strings suddenly makes it run much slower (memory problem?). If
you call the code with batches of strings it runs much faster.

So how do I do this? I have a "securities(0 to records -1)", and I
want to break that down into chunks of no more than 50 at a time. The
last array cannot have any empty cells at the end.

I thought of using a comma-delimited string of everything in
"securities" and then using Split, but that would always return the
first 50 strings, without some string manipulation anyway.

Maury


Reply
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
Sum parts of a column Roger Dodger Excel Discussion (Misc queries) 2 September 17th 09 06:31 AM
breaking down a whole number into pre-defined parts.. GD Excel Discussion (Misc queries) 4 February 2nd 09 01:21 PM
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
i have two parts of a solution but can still not get it to run tracks via OfficeKB.com Excel Programming 1 November 16th 06 02:13 AM
Totalling Sum of Parts in a 2 column array. steev_jd Excel Discussion (Misc queries) 2 April 26th 06 03:17 PM


All times are GMT +1. The time now is 03:06 PM.

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

About Us

"It's about Microsoft Excel"