See if this will work
With ActiveSheet
lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 1 Step -1
If Trim(.Cells(i, 8).Value) = "" _
Or Trim(.Cells(i, 7).Value) = "" Then
.Cells(i, 1).EntireRow.Cut
.Range("A65536").End(xlUp).Select
r = Selection.Row + 1
.Range("A" & r).Insert
End If
Next i
End With
"aileen" wrote:
> I am trying to cut a row of data that has either a blank cell in column G or
> column H and paste the whole row to the first blank row at the end of the
> active worksheet. the code I am trying is as follows:
>
> With ActiveSheet
> lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
> For i = lr To 1 Step -1
> If Trim(.Cells(i, 8).Value) = "" _
> Or Trim(.Cells(i, 7).Value) = "" Then
> .Cells(i, 1).EntireRow.Cut
> Range("A65536").End(xlUp).Select
> r = Selection.Row + 1
> Range("A" & r).Select.EntireRow.Paste
> End If
> Next i
> End With
>
> I am getting an object required error. Any help is always appreciated. Thanks.
>
|