MERGING COLUMNS TO ONE

F

Faraz A. Qureshi

Would one of you experts kindly devise me a code so as to merge the different
sizes of blocks of a table in a single column.

For example the source data is

A01 BX1 C2 D1
A02 BX2 D2
A03 BX3
A04 D3

What code could copy the columns onto some other location/sheet as follows:

A01
A02
A03
A04
BX1
BX2
BX3
C2
D1
D2
<<Blank Cell>>
D3

cpearson's outstanding the reversal, i.e. Column to Table at
http://www.cpearson.com/Excel/VariableBlockColumnToTable.aspx
but I sure am making mistakes in having the said code modified to carry out
such exercise the other way around.

Thanx in advance.
 
D

Don Guillett

Option Explicit
Sub makeallcolumnsone()
Dim i, slr, dlr As Long
For i = 2 To _
Cells(1, Columns.Count).End(xlToLeft).Column
slr = Cells(Rows.Count, i).End(xlUp).Row
dlr = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(1, i).Resize(slr).Copy Cells(dlr, 1)
Next i
End Sub
 

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