combining multiple rows into one row

R

Randy Allen

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

Don Guillett

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top