Delete rows that cell value is "No"

G

Guest

Hi and thanks in advance.

I have a range from A1:A500. The cells have Yes and No...is there anyway to
adjust my code to work? I'm trying to delete the rows that have cell value
of no.

Dim cl As String

cl = "No"

For Each cl In Range("a1:a500")
SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Next cl

thank you.

Tim
 
A

Ardus Petus

Sub Tester
dim rCell as Range
For each rCell in range("A1:A500")
if rCell.value="no" then rCell.Entirerow.Delete
next rCell
end sub

HTH
 
A

Ardus Petus

Ron is definitely right:

Sub Tester()
Dim lRow As Long
For lRow = 500 To 1 Step -1
If Cells(lRow, "A").Value = "no" Then
Rows(lRow).Delete
End If
Next lRow
End Sub


HTH
 

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

Top