Thread
:
Rows to Columns - Diff Size Rows of Data
View Single Post
#
5
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Rows to Columns - Diff Size Rows of Data
Glad to help
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Mishelley" wrote in message
...
Thank you very much for your help, Don. The code works perfectly!
Mishelley
"Don Guillett" wrote:
Sub transposeem()
lr = Cells(Rows.Count, 1).End(xlUp).Row
p1 = 2
cr = 1
Do Until p1 = lr
r1 = Cells(p1, 1).Row
r2 = Cells(p1, 1).End(xlDown).Row
Cells(r1, 1).Copy Cells(cr, 2)
Cells(r1 + 1, 1).Copy Cells(cr, 3)
If r2 - r1 = 3 Then
Cells(r1 + 2, 1).Copy Cells(cr, 4)
Cells(r1 + 3, 1).Copy Cells(cr, 5)
Else
Cells(r1 + 2, 1).Copy Cells(cr, 5)
End If
p1 = r2 + 2
cr = cr + 1
Loop
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Mishelley" wrote in message
...
Good Morning,
I have the following that I need to move into rows (records) - same
worksheet is fine. How can I do this when the address blocks are
different
sizes (some 3 and some 4 rows)? There is a blank row in between.
Thanks so much in advance!
Mishelley
Name
Address 1
City, State, Zip
Name
Address 1
Address 2
City, State, Zip
Name
Address 1
City, State, Zip
Name
Address 1
Address 2
City, State, Zip
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett