Macro to Manage Blocked Senders

B

Bob Simon

I have been manually using Excel to manage my Outlook blocked senders
list but it's gotten so large that I want to automate this task. I
thought that I could learn enough VBA to do this on my own but I can't
manage it. If someone would be willing to help, here's what I want to
accomplish:

Given
Worksheet with two columns
Each row represents an email address
Col A has the part of the email address before the @
Col B has the domain
An empty cell in Col A designates the entire domain
Worksheet is sorted in domain order

Goals
Where this worksheet contains multiple addresses from the same domain,
delete duplicate rows and blank col A for the remaining row.

After deleting the dups, I concatenate Col A + "@" + Col B and import
back into Outlook's blocked senders list.
 
G

Guest

use this as a starting point

Sub del()

For u = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
For g = ActiveSheet.UsedRange.Rows.Count - 1 To 1 Step -1
If Cells(u, 2).Value = Cells(g, 2).Value Then
jk = Trim(Str(g))
Rows(jk).Select
Selection.Delete Shift:=xlUp
Cells(u, 1).Value = ""
End If
Next
Next

End Sub
 

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