ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combining multiple rows into one row (https://www.excelbanter.com/excel-programming/428266-combining-multiple-rows-into-one-row.html)

Randy Allen

combining multiple rows into one row
 
Can anyone help with this issue? I have a spreadsheet with 3 rows of
data that I need to put on one row, then skip down 4 rows and pull the
next 3 rows of data into one row. Finally, I need all the rows together,
without blank rows between them.

The 3 rows are set up like this:
Row 1 - data in cells A - D
Row 2 - data in cells A - K
Row 3 - data in cells A - I

I need the data from the 3 rows put into 1 row - cells A - X.

The next set of data is 4 rows down. For example: the 1st set of data
begins on row 1, the next set on row 5, the next on row 9. I need the
program to repeat until all the data on the sheet is modified.

If anyone can help, I would really appreciate it.



*** Sent via Developersdex http://www.developersdex.com ***

Don Guillett

combining multiple rows into one row
 
Here is one I did for someone a couple of days ago. Modify to suit.

Sub lineemup()
dim i, lc1, lc2 As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Cells.WrapText = False

For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1

If Cells(i - 1, 1) = Cells(i, 1) Then
lc1 = Cells(i - 1, Columns.Count).End(xlToLeft).Column + 1
lc2 = Cells(i, Columns.Count).End(xlToLeft).Column
Cells(i, 2).Resize(1, lc2).Copy Cells(i - 1, lc1)
Rows(i).Delete
End If

Next

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Randy Allen" wrote in message
...
Can anyone help with this issue? I have a spreadsheet with 3 rows of
data that I need to put on one row, then skip down 4 rows and pull the
next 3 rows of data into one row. Finally, I need all the rows together,
without blank rows between them.

The 3 rows are set up like this:
Row 1 - data in cells A - D
Row 2 - data in cells A - K
Row 3 - data in cells A - I

I need the data from the 3 rows put into 1 row - cells A - X.

The next set of data is 4 rows down. For example: the 1st set of data
begins on row 1, the next set on row 5, the next on row 9. I need the
program to repeat until all the data on the sheet is modified.

If anyone can help, I would really appreciate it.



*** Sent via Developersdex
http://www.developersdex.com ***


Randy Allen

combining multiple rows into one row
 
Thank you, I was able to get everything working with your help.



*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 02:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com