View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default A hard one for manipulating arrays

Code reuse. Your procedure combines two arrays. You want to combine arrays
A, B, C, D, E. Use your procedure to bind A and B, then reuse it to combine
[AB] and C, [ABC] and D, and finally [ABCD] and E.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Albert" wrote in message
...
Hello and Happy New Year...
I recently created a nice little procedure that "bonds" two arrays
toghether
(see below). I now want to make a procedure that bonds a variable number
of
arrays (they are all two dimentional and all have the same horizontal
Ubound). For example, sometimes I have to bond only 2 arrays, but
sometimes I
may have to bond 5 of them toghether. I haven't been able to figure it
out.
Perhaps someone has done something similar or has some ideas?
Thanks in advance,
Albert C

Public RegistrosExistentes() As Variant
Public Const TotalFields = 13
Sub ConstruirArrayRegistrosExistentes(Arr1, Arr2)
ReDim RegistrosExistentes(1 To (UBound(Arr1, 1) + UBound(Arr2, 1)), 1 To
TotalFields)

For x = 1 To UBound(Arr1, 1)
For Y = 1 To TotalFields
RegistrosExistentes(x, Y) = Arr1(x, Y)
Next Y
Next x
For x = 1 To UBound(Arr2, 1)
For Y = 1 To TotalFields
RegistrosExistentes(UBound(Arr1, 1) + x, Y) = Arr2(x, Y)
Next Y
Next x
End Sub