Array assignment

V

Varun

Hi,

I have two arrays that I'd like to assign to a different 2 dimensional
array. For example, array1 is one dimensional and so is array2. These
arrays are returned to me via different sub procedures.

I'd like to assign the array values of array1 and array2 to a new array
named array3 which is 2 dim i.e. has rows and cols.

I know the following wouldn't work i.e. need a loop or something...any
pointers will be appreciated.

array3(r, 1) = array1
array3(r, c) = array2

Thanks for help.
 
P

Per Jessen

Hi

Look at this example:

Sub bbb()
Dim MyArray1(10)
Dim MyArray2(10)
Dim MyArray3

ReDim MyArray3(UBound(MyArray1), 2)
For r = LBound(MyArray3, 1) To UBound(MyArray3, 1)
MyArray3(r, 1) = MyArray1(r)
MyArray3(r, 2) = MyArray2(r)
Next
End Sub

Regards,
Per
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top