Remove Spam Emails From Total Client List

IREALLYambatman

Board Regular
Joined
Aug 31, 2016
Messages
63
So were a tiny science company and I'm trying to help out 'sales' department girl by setting up a macro that will simplify her job a bit... She has a ton of emails and a list of customers who want to be removed from the email list. I'm trying to automate this for her.. I found some stuff out there and got decently far, so on the first tab I have all the clients info, second tab is the list of emails that she wants removed, THIRD tab I want it to be all the clients with all their info that DIDN'T opt out of the emails. The function I currently have labels the clients that want to be removed, but I can't figure out how to copy all clients that HAVENT OPTED OUT to the third tab. If it can be dont via functions then great, otherwise a macro would work too.

I appreciate the help guys.
jhXVia
jhXVia

Tab1 Tab2

The Function I am using is:
Code:
=IF(ISERROR(MATCH('ALL CLIENTS'!E2,OptedOutEmails!A2:A1001,0)),"OK","OptedOut")
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
So I decided to create a macro that will delete the Rows that have "OptedOut" in the K column.. This is what I have so far.. Apparently my range is wrong.. I just want it to repeat for RowK1 --> Row KLastrow, then delete row if that value is "OptedOut"

Code:
Sub DuplicateDelete()

Sheets("ALL CLIENTS").Range("A1:J10000").Copy Destination:=Sheets("ClientsAndEmailsThatAreOK").Range("A1:J10000")
With ActiveSheet
    lastRow = .Cells(.Rows.Count, "K").End(xlUp).Row
    MsgBox lastRow
End With


Dim c As Range
For Each c In Range(Range("K1"), Cells(lastRow, K))
    If c.Value = "OptedOut" Then Rows(1).EntireRow.Delete
Next c




End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,991
Messages
6,175,820
Members
452,672
Latest member
missbanana

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