Delete Rows with #N/A

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

How can I delele, in a VBA macro, all rows in Columns B & D that contains
#N/A ?
Thanks,
 
Jeff,

If that is the only error that you expect, and you have formulas returning
the errors, then you could use the one liner:

Range("B:B,D:D").SpecialCells(xlCellTypeFormulas, 16).EntireRow.Delete

Of course, you would need an

On Error Resume Next

before that if it is possible that there aren't any errors.

HTH,
Bernie
MS Excel MVP
 
Jeff,

Try the following code:


Dim RowNdx As Long
For RowNdx = Cells(Rows.Count, "B").End(xlUp).Row To 1 Step -1
If IsError(Cells(RowNdx, "B").Value) = True Then
If Cells(RowNdx, "B").Value = CVErr(xlErrNA) Then
Rows(RowNdx).Delete
End If
End If
Next RowNdx


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top