Creating a macro that will cut odd numbered rows and paste into the row above

alef1234

New Member
Joined
Nov 12, 2015
Messages
17
Hi. I have an excel sheet with about 4,500 rows of data. For some reason the paste I received from the web splits each row on the web into 2 rows in excel. I am trying to take the data in row 3 (Cells A3 through E3) and move into row 2 (Cells G2 through K2). Then I would like the macro to either delete row 3 or go to row 5 and do the same cut and past of that data into the row above. Basically I would like themacro to do this for every odd row through row 4,500. Is this possible. Thank you.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hey,

there probably is a way to do it way faster, but you could give this a try:

Code:
Sub MergeRows()
Dim LastRow As Long, i As Long
Application.ScreenUpdating = False

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = LastRow To 3 Step -2
    Range(Cells(i - 1, 7), Cells(i - 1, 11)).Value = _
    Range(Cells(i, 1), Cells(i, 5)).Value
    Rows(i).EntireRow.Delete
Next i

Application.ScreenUpdating = True
End Sub

Julian
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,721
Members
449,093
Latest member
Mnur

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