View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Stratuser Stratuser is offline
external usenet poster
 
Posts: 63
Default Append One Array to Another, and Consolidate

Unfortunately, I can't start off with them in a single array, because it
takes one complex operation to get the data for the first array, and then
another operation to get the data for the second array. I was trying to get
all the data into one array to keep from having to do endless lookups between
the two arrays later in the process.

I was hoping to combine the arrays, but it looks like maybe I should look
into whether I can just do the work with two separate arrays -- or go back to
doing things on a worksheet, which is my old method (it does work, but it
isn't as clever as using arrays).

"NickHK" wrote:

Could you start off with all the data in a single array ?
Then you do not have to combine them later.

Dim var As Variant

var = Union(Range("A1:B4"), Range("A5:B8"))

NickHK

"Stratuser" ...
The values are both strings (ticker symbols) and numbers associated with
the
tickers. They are pulled from columns on a worksheet.

"Morris" wrote:


Stratuser wrote:
Yes, but there is one other thing: My arrays are two-dimensional,
based on a
row and column structure, like a range. If I use ReDim Preserve to
increase
the big array to add the non-duplicate elements, I can only increase
the last
dimension of the array. Since I'm adding rows in effect, I guess I
would
need the array structure to be Array(column, row) instead of Array(row,
column). Right?

dunno :)

What kind of values have you got in the inner array? could you
consolidate them to a string using Join method - for the time of
comparation, and array redimensioning, and then do a loop throughout
the array to split them back? It's just a loose idea, as I'd prefere to
see the example itself