If value delete row

G

Guest

I need to evaluate one column and if it contains specific text, then I want
the entire row's information cleared. If there a function or macro that could
do this?

Example
A B C D
NAME NUMBER DATE FINAL
1 John Doe 123 3/9/2007 Growth of
2 Jane Smith 456 3/9/2007 Bug1
3 Bill Doe 789 3/9/2007 BugA

In this case I would want row 1 to either have contents cleared or row 1 to
be deleted.
 
G

Guest

Which particular part of row 1 was the selection criteria for the row being
deleted?

Mike
 
G

Guest

Sorry read your post again it must be John Doe that triggered the delete do
try:-

Sub Deleterows()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim lastrow As Long, r As Long
lastrow = ActiveSheet.UsedRange.Rows.Count
For r = lastrow To 1 Step -1
If Cells(r, 1).Value = "John Doe" Then Rows(r).Delete
Next r
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Note this is case sensitive for John Doe. Will that do?

Mike
 
G

Guest

Mike,

Sorry, I was actually looking to evaluate the last column, "GROWTH OF"
This is lab information, where I have multiple rows of the same information,
and I just want the final result to be the bacteria name (i.e. Bug 1, Bug 2,
Bug A, etc.). I think I can adapt your suggestion to fit what I need, though.
 
G

Guest

Thanks for the reply. Simply change the column number from 1 to 4 to work on
column D and use:-

If UCase(Cells(r, 4).Value) = "YOURTEXT" Then Rows(r).Delete

if case is an issue

Mike
 
G

Guest

That did the trick, thanks so much, my life just got a little easier...now
where did those winning lottery tickets go?
 

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