Move next column to next row using macro?

corescript

New Member
Joined
Jan 27, 2015
Messages
10
Dear all
i've data like this:
Code:
A            B         C                D 
1 John       Willy      Diana            Chan Yu
2 male       male      Female            Male
3 married    single    Single            Single
4 Ohio       Texas     Las Vegas         New York
5 yes        NA        Yes               No
and i want to move next column to next row such as below
Code:
   A         B          C         D
1 John    
2 male    
3 married 
4 Ohio    
5 yes     
6 Willy 
7 male  
8 single
9 Texas 
10 NA
11 Diana        
12 Female   
13 Singe    
14 Las Vegas
15 Yes
16 Chan Yu      
17 Male
18 Single
19 New York
20 No
thank you
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Code:
Sub NextColToNextRow()
Dim nxRw As Long, R As Range, i As Long
Set R = Range("A1").CurrentRegion
Application.ScreenUpdating = False
For i = 2 To R.Columns.Count
       nxRw = Range("A" & Rows.Count).End(xlUp).Row + 1
       Range("A" & nxRw).Resize(R.Columns(i).Rows.Count, 1).Value = R.Columns(i).Value
Next i
Range(R.Columns(2), R.Columns(R.Columns.Count)).ClearContents
Application.ScreenUpdating = True
End Sub
 
Upvote 0
MAybe
Code:
Sub MM1()
Dim lr As Long, lc As Integer, lr2 As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
lc = Cells(1, Columns.Count).End(xlToLeft).Column
    For c = 2 To lc
        lr2 = Cells(Rows.Count, c).End(xlUp).Row
        Range(Cells(1, c), Cells(lr2, c)).Copy Cells(lr + 1, 1)
        lr = Cells(Rows.Count, "A").End(xlUp).Row
    Next c
Range(Cells(1, 2), Cells(1, lc)).EntireColumn.Delete
End Sub
 
Upvote 0
dear all
I've new case. how to solve this using formula or macro?
Code:
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
3
3
4
4
4
4
4
4
and so on
 
Last edited:
Upvote 0
What is the problem.....all we see is a list of numbers...!
What do you want to do with them ???
 
Upvote 0
Are they always in blocks of 6 numbers ???
 
Upvote 0
try this
Code:
Sub MM1()
Dim x As Long, lr As Long
lr = Range("A" & Rows.Count).End(xlUp).Row
For x = 1 To lr Step 6
   Range("A" & x).Resize(6, 1).Copy
   Range("B" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Transpose:=True
Next
Columns("A:A").EntireColumn.Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,272
Members
449,075
Latest member
staticfluids

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