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.
 

j_unsuitable

Board Regular
Joined
Oct 28, 2015
Messages
235
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
 

Forum statistics

Threads
1,081,800
Messages
5,361,382
Members
400,629
Latest member
ganeshkhatri

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top