Delete data in cells that don't meet criteria

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

Guest

I'm not sure how I would code deleting any data in the cells in Column "Type"
if it is not "HO". The report I download sometimes puts odd letters in cells
in this column and I just want to clear it out rather than scan this very
long report and delete manually. I will put the code in an existing macro.
Thank you
 
sitcfantn, here is one way

Sub Delete_HO()

Dim iRow As Long
Dim SpecValue As String

SpecValue = "HO"

If SpecValue = "" Then Exit Sub

For iRow = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
If Cells(iRow, 1) = SpecValue Then Rows(iRow).Delete
Next iRow

End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
Back
Top