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
 
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

helo MM what i mean is fill rows automatically with number
Code:
      A
1     1
2     1
3     1
4     1
5     1
6     1
7     2
8     2
9     2
10    2
11    2
12    2
13    3
14    3
15    3
16    3
17    3
18    3
19    4
20    4
21    4
22    4
23    4
24    4
25
26

and so on
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
So that it looks like this ??
If not, you need to provide a before and after example



Excel 2007
ABCDEF
2111111
3222222
4333333
5444444
Sheet1
 
Upvote 0
before

A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

<tbody>
</tbody>

after

A
11
21
31
41
51
61
72
82
92
102
112
122
133
143
153
163
173
183
194
204
214
224
234
244
255
265
275
285
295
305
316

<tbody>
</tbody>

and so on

Thank you
Best Regards
 
Last edited:
Upvote 0
Code:
Sub MM1()
Dim x As Long, n As Integer
n = 1
For x = 1 To 90 Step 6 'change the 90 to the number of rows you need
   Range("A" & x).Resize(6, 1).Value = n
   n = n + 1
Next
End Sub
 
Upvote 0
Code:
Sub MM1()
Dim x As Long, n As Integer
n = 1
For x = 1 To 90 Step 6 'change the 90 to the number of rows you need
   Range("A" & x).Resize(6, 1).Value = n
   n = n + 1
Next
End Sub

SMART that the word I want to say to you Michael M

thank you

Best Regards
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,851
Members
449,194
Latest member
HellScout

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