View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Macro to Manage Blocked Senders

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


"Bob Simon" wrote:

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.

--
Bob Simon
remove both "x"s from domain for private replies