ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to Manage Blocked Senders (https://www.excelbanter.com/excel-programming/321830-macro-manage-blocked-senders.html)

Bob Simon

Macro to Manage Blocked Senders
 
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

Ben

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



All times are GMT +1. The time now is 11:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com