Hello! I have several hundred lines of data on one worksheet, where I'm looking for "IMP" in column A and deleting the row with "IMP" in it. The word "IMP" can appear on any row within the column. I have two issues that I can't figure out. The first is, how do I select column A without setting a range of rows? The second is, when this code runs I receive an error "Type mismatch" after the last "IMP" line is deleted.
Thanks in advance!
Book2.xlsm![]()
Sub DeleteCells1() Dim rng As Range Dim i As Integer, counter As Integer Set rng = Range("A5:A165") i = 1 For counter = 1 To rng.Rows.Count If rng.Cells(i) = "IMP" Then rng.Cells(i).EntireRow.Delete Else i = i + 1 End If Next End Sub
Bookmarks