View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Deleting rows with #N/A

I like Tom's suggestion best, but ...

If Cells(i, 5).Text = "#N/A" Then
or
if iserror(cells(i,5).value) then

Mark wrote:

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


--

Dave Peterson