Thread: Array+Array
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JVBeaupre JVBeaupre is offline
external usenet poster
 
Posts: 1
Default Array+Array

On Jan 7, 9:23*am, Danny wrote:
Hi,

I have 2 (or more) arrays, how can i combine them into 1?

example:
Array 1 = "1, 2, 3, 4"
Array 2 = "A, B, C, D, E, F"

Result:
Array_Combined = "1, 2, 3, 4, A, B, C, D, E, F"

br,
Danny


If the arrays are literally strings then this should work:
Array_Combined = Array_1 & "," & Array_2

If the arrays are true arrays with Array_2(4)= D (some value)
then try this:
dim Array_Combined()
length= ubound(Array_1)+ubound(array_2)+2-lbound(array_2)-lbound
(array_1)
redim Array_Combined( lbound(array_1) to length + lbound(array_1) - 1)
i=lbound(array_1)-1
for j=lbound(array_1) to ubound(array_1)
i=i+1
Array_Combined(i)=array_1(j)
next j
for j=lbound(array_2) to ubound(array_2)
i=i+1
Array_Combined(i)=array_2(j)
next j

or something like that.
Jim