VBA code for cut and paste in a loop


New Member
Sep 11, 2011
Hi Knowledgeable people

I am a novice Excel VBA user who is trying to create a cut and paste procedure that moves every second cell in a column of data up adjacent to the first cell and then deletes the blank line.

ie. Raw data in column A is:
Number 1
Description 1
Number 2
Description 2
Number 3
Description 3

I want to move "description 1" into Column B adjacent to "Number 1" and then delete the empty line. Then move "description 2 into Column B adjacent to "Number 2" and delete the empty line. etc

I managed to write a macro to do this as a one off, but I get into horrible trouble when I try to repeat it. I just don't know what I am doing the items in under "number" are not different (in terms of the types of characters) to those under description. I suspect it is a backwards loop that I need and I don't know how to write that and put a cut, paste and delete procedure in the middle of it.

Many thanks to anyone who can start me on the right track


jim may

Well-known Member
Jul 4, 2004
Perhaps a bit technically lacking, but this seems to work (only according to your specs)..

Sub Foo()
Dim i As Long, LR As Long
Application.ScreenUpdating = False
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & LR).Select
On Error Resume Next
ActiveCell.Offset(-1, 1).Select
On Error GoTo errHandler
ActiveCell.Offset(-1, -1).Select
Loop Until ActiveCell = Range("A1")
Exit Sub
Range("A" & LR).Select
For i = LR To 2 Step -1
    If Cells(i, 1).Value = "" Then Cells(i, 1).EntireRow.Delete
Next i
Application.ScreenUpdating = True
End Sub


New Member
Sep 11, 2011
Hi Jim
It worked! Thankyou so much for your assistance.

I'll go through it and see if I can work out how it all works!

Georgia :)

Forum statistics

Latest member

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