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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
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,216,101
Messages
6,128,837
Members
449,471
Latest member
lachbee

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