Delete a cell value if not "like"

  • Thread starter Thread starter Kryten
  • Start date Start date
K

Kryten

Hi,
Would it be possible to delete cell contents based on the value of
that cell.

Eg if the cell contains anything EXCEPT "*IMPORTANT*" then the content
would be cleared.

Thanks,
Stuart
 
Dim LastRow As Long
Dim i As Long

With Activesheet

.Cells(.Rows.Count,"A").End(xlUp).Row
For i = LastRow To 1 Step -1

If Not .Cells(i, "A").Value Like "*IMPORTANT*" Then

.Rows(i).Delete
End If
Next i
End With
 
Back
Top