How to copy columns to a specific column header and repeat? [Solved/Closed]

Posts
2
Registration date
Friday October 13, 2017
Status
Member
Last seen
November 10, 2017
-
Hello all, am new to using macros in excel. i have data and i want to be able to columns and paste it under some specific columns repeatedly.

Example
column A Column B Column C ColumD
1 2 1 5
2 1 1 2
3 2 1 2


I want to obtain a result where like example column B, Column C and Column D are all pasted under Column A

Result should look like this

Column A
1
2
3
2
1
2
1
1
1
5
2
2

the problem is the columns are soo many i want to automate it. I am new to programming any help.

Thanks
See more 

1 reply

Posts
2570
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 3, 2019
377
0
Thank you
Hi Stylus,

The following code will help you out:
Sub RunMe()
Dim lCol, x As Integer

lCol = Cells(1, Columns.Count).End(xlToLeft).Column

For x = 2 To lCol
    ActiveSheet.UsedRange.Columns(x).Cut _
    Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Next x

End Sub


Best regards,
Trowa
stylus33
Posts
2
Registration date
Friday October 13, 2017
Status
Member
Last seen
November 10, 2017
-
Thanks buddy..it works