Multiple Columns into one Column

junkforhr

Board Regular
Joined
Dec 16, 2009
Messages
115
Office Version
  1. 365
Platform
  1. Windows
Does anyone know how to do this? I have lots of columns that need to be stacked into a single column (I do not want to combine or concantenate)
eg put all data in column B,
column C, column D,column F and column E and stack them one under each other into a single column in column A. I have many many columns each with approx 500 rows of cells.All columns are in the one sheet.
Any ideas appreciated.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this

Code:
Sub MoveAllDataToColumnA()
    Dim i As Long, ws As Worksheet, rngCopy As Range, rngEnd As Range
    Set ws = ActiveSheet
    Do Until ws.Cells(1, 2).Value = ""
        Set rngCopy = ws.Range("B2", ws.Cells(ws.Rows.Count, "B").End(xlUp))
        Set rngEnd = ws.Cells(ws.Rows.Count, "A").End(xlUp).Offset(1, 0)
        rngEnd.Resize(rngCopy.Rows.Count, 1).Value = rngCopy.Value
        rngCopy.EntireColumn.Delete
    Loop
End Sub
 
Upvote 0

Sankar,

I think the OP is looking for the opposite...


http://www.cpearson.com/EXCEL/TableToColumn.aspx


Using VBA:

Excel Workbook
BCDE
1Col 1Col 2Col 3Col 4
2ABCDEFGHIJKL
3MONPQRSTUVWX
4YZABCDEFGGIJ
5KLMNOPQRSTUV
6WXYZABCDEFGH
Sheet1
Excel Workbook
A
1Single Column
2ABC
3DEF
4GHI
5JKL
6MON
7PQR
8STU
9VWX
10YZA
11BCD
12EFG
13GIJ
14KLM
15NOP
16QRS
17TUV
18WXY
19ZAB
20CDE
21FGH
Excel 2003 Sheet1
Excel 2003



Code:
Sub TableToColumn()
    Dim Rng As Range, LR As Long, i As Long
    LR = Range("B" & Rows.Count).End(xlUp).Row
    For i = 2 To LR
        Set Rng = Range("B" & i, "E" & i) 'Change range to suit needs
        Range("A" & Rows.Count).End(xlUp)(2).Resize(Rng.Count) = Application.WorksheetFunction.Transpose(Rng)
    Next i
End Sub
 
Last edited by a moderator:
Upvote 0
You can do it with this formula
Excel Workbook
ABCDEF
1R1, C1R1, C2R1, C3R1, C4R1, C1
2R2, C1R2, C2R2, C3R2, C4R2, C1
3R3, C1R3, C2R3, C3R3, C4R3, C1
4R4, C1R4, C2R4, C3R4, C4R4, C1
5R5, C1R5, C2R5, C3R5, C4R5, C1
6R1, C2
7R2, C2
8R3, C2
9R4, C2
10R5, C2
11R1, C3
12R2, C3
13R3, C3
14R4, C3
15R5, C3
16R1, C4
17R2, C4
18R3, C4
19R4, C4
20R5, C4
...
Cell Formulas
RangeFormula
F1=OFFSET($A$1, MOD(ROW()-ROW($F$1),ROWS($A$1:$A$5)), TRUNC((ROW()-ROW($F$1))/ROWS($A$1:$A$5)),1,1)



and this formula from www.cpearson.com
Regards
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,249
Members
448,879
Latest member
oksanana

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