Simple Question: Snaking data --Flatten a matrix

jsvlad

New Member
Joined
Nov 23, 2010
Messages
8
I currenlty have data formated like this:


1 4 7
2 5 8
3 6 9


that is..
A1 =1
A2 =2
B1 = 4

If i want the data to be


1
2
3
4
5
6
7
8
9



That is for a simple 3x3 matrix..
but how do i do it with a macro for a matrix that is
4x6 or 7 x 8

or X x Y

I think this is called "flattening"

Thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try

Code:
Sub flat()
Dim LR As Long, LC As Long, j As Long
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
LC = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
For j = 2 To LC
    Range(Cells(1, j), Cells(LR, j)).Cut Destination:=Cells(Rows.Count, 1).End(xlUp).Offset(1)
Next j
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,551
Members
452,927
Latest member
rows and columns

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