From column to matrix

ezequiel

New Member
Joined
May 26, 2011
Messages
1
Hi everyone,

Does someone know any macro that can let me change a column with a ton of cells into a matrix m x n?

I badly need this since I have a lot of cells in the column and the matrix has to be 356 x 94 !

Thanks a lot
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Welcome to the board.

Assuming your data is in column A, the code below will copy 356 rows and paste into column B and then onwards until the last row in column A. You'll probably need to adjust settings to fit your own requirements

Try:
Code:
Sub IncestousTurtles()
Dim i As Long, r As Long, c As Long
Application.ScreenUpdating = False
r = 356
c = 2
For i = 1 To Range("A" & Rows.Count).End(xlUp).row Step 356
    Range(Cells(i, 1), Cells(i + 355, 1)).Copy
    Cells(1, c).PasteSpecial Paste:=xlValues
    c = c + 1
Next i
Application.ScreenUpdating = True
End Sub
 
Upvote 0
hi,

original col data in column A, matrix printout from cell C1 on and down, or can be used under name matr in any further use.
Code:
Sub coltomatrix()
Dim a As Variant, matr(), r As Long, s As Long
Dim i As Long, j As Long, k As Long
r = 356
s = 94
a = Range("A:A")
ReDim matr(1 To r, 1 To s)
For j = 1 To s
    For i = 1 To r
        k = k + 1
        matr(i, j) = a(k, 1)
Next i, j
Range("C1").Resize(r, s) = matr
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,874
Members
452,949
Latest member
Dupuhini

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