-3

I am looking to copy paste and delete a entire row based on if Column A has"xyz" ie:If A1="xyz" then copy paste(a1:g1) into next blank row and delete row 1:1.

1 Answers1

1

A custom sort that places xyz after all else might be the better solution. If you need to copy/paste/delete then remember that it is always best to start at the bottom and work up in your For ... Next loop when deleting rows.

Dim r As Long, lr As Long
With ActiveSheet
    lr = .Cells(Rows.count, 1).End(xlUp).Row
    For r = lr To 1 Step -1
        If LCase(.Cells(r, 1)) = "abc" Then
            .Cells(r, 1).Resize(1, .Cells(r, Columns.count).End(xlToLeft).Column).Copy _
              Destination:=.Cells(Rows.count, 1).End(xlUp).Offset(1, 0)
            .Rows(r).Delete
        End If
    Next r
End With
  • 1
    @pnuts - That *abc* Easter egg has traditionally been a tough nut to crack. :) –  Nov 27 '14 at 19:16