Delete a cell value if not "like"

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
 
B

Bob Phillips

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
 

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