View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Deleting rows with #N/A

Sub DeleteRows()
columns(5).SpecialCells(xlformulas,xlerrors).Entir eRow.Delete
End Sub

--
Regards,
Tom Ogilvy


"Mark" wrote in message
...
I am using Excel 97 and want to delete rows of data which have a value of
#N/A in them which is the result from a vlookup formula.

I am using the following code but it is debugging with Type mismatch!

For i = 2 To LastRow

Cells(i, 5).Select

If Cells(i, 5).Value = "#N/A" Then
ActiveCell.EntireRow.Select
Selection.EntireRow.Delete
End If
Next i

Can anyone help with a solution, please?

--
Mark