Reputation: 11
This is what I have already. It searches column B in sheet 1 for #N/A and deletes the row.
Sub DeleteErrorRows()
On Error Resume Next
Range("B:B").SpecialCells(xlCellTypeConstants, 16).EntireRow.Delete
On Error GoTo 0
End Sub
What I would like is for it to copy that row onto sheet 2 and then delete? So I can have a record of what was deleted.
Any help would be much appreciated. Thanks!
Upvotes: 1
Views: 715
Reputation: 96763
Consider:
Sub DeleteErrorRows()
Dim r As Range
Set r = Range("B:B").SpecialCells(xlCellTypeConstants, 16).EntireRow
r.Copy Sheets("Sheet2").Range("A1")
r.Delete
End Sub
Upvotes: 1