Data in rows into columns (transpose, macro codes needed)

fazraza81

New Member
Joined
Nov 3, 2016
Messages
10
I currently have data in cells A1-A21228 (all in 1 column). I need it to go from:

Column A
Data line 1
Data line 2
Data line 3
Data line 4
Data line 5
Data line 6
Data line 7
Blank row(space)
Data line 1
.....
and so forth

to:


Column A Column B Column C Column D Column E Column F Column G
Data line 1 Data line 2 Data line 3 Data line 4 Data line 5 Data line 6 Data line 7

Please help me with the right macro code.

Also, in between each data 'item' there is a blank row(space). So the 8th row is blank, then a new data 'item' starts again on the '9th row', for another 7 rows, and so forth.

Please help! Thank you so much
 
Last edited:

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Code:
Sub do_it()

c = 2
wr = 2

For r = 2 To Range("A" & Rows.Count).End(xlUp).Row

Cells(wr, c) = Cells(r, "A")

If Cells(r, "A") = "" Then
    wr = wr + 1
    c = 2
    GoTo 99
End If


c = c + 1


99 Next r
End Sub
 
Upvote 0
Thank you so much for your help!

Question - If the data is not uniform, meaning the transpose doesn't all work (not always 7 rows of data). Can we put an IF statement to say if there are more or less than 7 rows, then start with the next 'item'? Thank you
 
Upvote 0
It is already setup to work with any number of data row, it will transpose the list every time it finds a space in coulum "A"
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,099
Members
452,379
Latest member
IainTru

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