delete rows

  • Thread starter Thread starter STEVEB
  • Start date Start date
S

STEVEB

Does anyone have suggestions for a Macro that would look at column F an
delete the entire row if the value is NOT "A" or "L"?

Any help would be greatly appreciated!

Thank
 
Steve,

Sub SteveDeleter()

Range("F1", Range("F65536").End(xlUp)).AutoFilter _
Field:=1, Criteria1:="<>A", _
Operator:=xlAnd, Criteria2:="<>L"
On Error Resume Next
Range("F2:F65536").SpecialCells(xlCellTypeVisible).EntireRow.Delete
Range("F:F").AutoFilter

End Sub

HTH,
Bernie
MS Excel MVP
 
hi.
try something like this.....
Sheets("Sheet1").Select
Set Item1 = Range("F2")
Do While Not IsEmpty(Item1)
Set Item2 = Item1.Offset(1, 0)
If Item1.Value <> "A" or
Item1.value <> "L" Then
Item1.EntireRow.Delete
set Item1 = Item2
End If
Loop
Regards
Frank
 

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