VBA: How to merge six seperate 10x1 arrays into one 10x6 array?

MikeCas

New Member
Joined
Nov 21, 2018
Messages
1
I'm working on a linear regression sub that creates a model equation to predict data points and I've reached a standstill in my project as I cant seem to find a pathway to merging the six 10x1 arrays into a single 10x6 array in order to perform a series of matrix manipulations using the 10x6 array. Each column of the 10x6 array needs to be composed entirely of the elements from the same 10x1 array. Any help pointing me in the right direction would be greatly appreciated.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,

There might be an easy way to union them but the method out of my head would be

Code:
Dim MyArray(10, 6) As Variant
    Dim r As Long [COLOR=#008000]'row[/COLOR]
    Dim c As Long [COLOR=#008000]'column[/COLOR]
        For r = 1 To 10
            For c = 1 To 6
             [COLOR=#008000]  'Assign Array to Column[/COLOR]
                   If c = 1 Then
                       MyArray(r, c) = [COLOR=#0000ff]Array1[/COLOR](r)
                   End If
                  if c=2 then
                     MyArray(r, c) = [COLOR=#0000ff]Array2[/COLOR](r)
                   End If
[COLOR=#008000]                   'and so on[/COLOR]
          Next c
      Next r
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top