ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combining two arrays (https://www.excelbanter.com/excel-programming/290291-combining-two-arrays.html)

dan

Combining two arrays
 
Is there an easier way to append one array on to another

I know I can a loop from lbound to ubound of an array putting it in ubound+1 with the appropriate redims but I was hoping for something shorter

Also while I am here is there an internal array sort function? and if so can it handle multidimensional arrays?

acw[_2_]

Combining two arrays
 
Dan

There have been various articles in the newsgroup that cover both your questions. Go to the GOOGLE site and select groups. In the advanced group search, put in combining arrays and the newsgroup microsoft.public.excel.programming. Similarly for sorting arrays.

Discussion there seems to be that the best way to combine arrays is to loop. Alternatively you can use the Array function to make the array of arrays then index the items. Seems you have to know the bounds of the individual arrays.

arr1 = Array("a", "b")
arr2 = Array("c", "d")
arr3 = Array(arr1, arr2)

so arr3 (0) (0) = "a", arr3(0) (1) = "b" ....

Sorting seems to be to build your own code for bubblesort, quicksort etc. Various items give the code needed.

HTH

Tony

----- dan wrote: -----

Is there an easier way to append one array on to another?

I know I can a loop from lbound to ubound of an array putting it in ubound+1 with the appropriate redims but I was hoping for something shorter.

Also while I am here is there an internal array sort function? and if so can it handle multidimensional arrays?

Alan Beban[_4_]

Combining two arrays
 
The freely downloadable file at http://home.pacbell.net/beban contains
at least a couple of functions that might be helpful in combining
arrays, depending on exactly what you're trying to accomplish. They do
usually involve looping, but that looping is pre-written. If you have
any interest in that, you might post back with some details. E.g., are
the arrays the same sizes? Same number of rows, different number of
columns? Vice versa? Are they of the same variable type?

Alan Beban

dan wrote:
Is there an easier way to append one array on to another?

I know I can a loop from lbound to ubound of an array putting it in ubound+1 with the appropriate redims but I was hoping for something shorter.

Also while I am here is there an internal array sort function? and if so can it handle multidimensional arrays?




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com