Delete Rows then Move Up
Try this. It looks for the N/A error.
Sub Delete_NA()
Dim MyCell As Range
For Each MyCell In Range("B1:B3000")
If Application.WorksheetFunction.IsNA(MyCell) = True Then
MyCell.EntireRow.Delete
End If
Next
End Sub
Gordon wrote:
Hi...
The procedure stops on this line: Run-time error 13 Type mismatch
If MyCell.Value = "#N/A" Then
Any clues?
Thanks in advance...
Gordon...
" wrote:
In the Worksheet module:
Sub Delete_NA()
Dim MyCell As Range
For Each MyCell In Range("B1:B3000")
If MyCell.Value = "N/A#" Then
MyCell.EntireRow.Delete
End If
Next
End Sub
Gordon wrote:
Hi...
I have 3000 records. In column B there are sporadic #N/A values. I need some
nicely packaged code that will delete all rows where a #N/A appears in B, so
that there are no gaps in the rows. Sounds easy but I'm struggling.
Any help would be most appreciated.
Thanks
Gordon...
|