Delete Entire rows if found specific word in a column

tajulit

Board Regular
Joined
Oct 24, 2015
Messages
111
I want if cell contains word "hotmail" and "live" then delete entire rows.
Here Is a example Sheet:
Column AColumn B
amin@hotmail.comAnything
amilo@live.comAnything
jama@gmail.comAnything
amcdfdin@hotmail.comAnything
karim@vertivite.comAnything

<tbody>
</tbody>

Here Is an Output Example:
Column AColumn B
jama@gmail.comAnything
karim@vertivite.comAnything

<tbody>
</tbody>

Thanks in Advance
Tajul
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Personally I would avoid the looping methods. One way is to use the autofilter as below.
I also assume looking at your result data that you meant or rather than and in
word "hotmail" and "live"
Please note that you must have a header row (which you haven't in your example).

Code:
Sub FilterDelete()
    Application.ScreenUpdating = False
    
    With Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
        .AutoFilter 1, "*hotmail*", xlOr, "*live*"

        On Error Resume Next
        .Offset(1).Resize(.Rows.Count - 1).SpecialCells(12).EntireRow.Delete
        On Error GoTo 0
        .AutoFilter

    End With
    
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top