HELP modifying macro to delete rows if more than 1 condition met &

M

Mayte

I got his code and it works fine but wondering if it can be modified to
delete not only rows that have "TRUE" in column in A but other 3 or 4
different calues in column B...

Sub UPDATE_TENURE()
Dim MyRange, MyRange1 As Range
Dim LastRow As Long
Set Sht = Sheets("Agent Tenure")
LastRow = Sht.Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Sht.Range("A1:A" & LastRow)
For Each c In MyRange
If UCase(c.Value) = "TRUE" Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.Delete
End If
End Sub
 
R

Rick Rothstein

Yes, it can be modified. You didn't say what your other conditions are, but
generally you would OR them into this line of code...

If UCase(c.Value) = "TRUE" Then

For example...

If UCase(c.Value) = "TRUE" Or UCase(c.Value) = "NewCondition" Then

Just keep OR'ing your new conditions in the same way I added the
"NewCondition" above.
 

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