Only running an action once per entry

bruty

Active Member
Joined
Jul 25, 2007
Messages
453
I have some code that sends an email to the list of people in a selected range, but recently there have been duplicates in the range due to the way the data is keyed.

Is there any way of adding in some code that checks if the name has already been actioned and so skip that entry.

The email addresses are in column A and I just select the range I want (eg A2:A1500) then run the macro on that selection.

Hope someone understands this, as I don't think I've explained it very well.

Cheers,

bruty
 
But using the code you have posted above, it performs the action for every cell selected - it doesn't omit the duplicates :(
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
It should be:

Code:
If WorksheetFunction.CountIf(Range(Cells(Firstrow, Range("ContactEmail").Column), _
    Cells(crow, Range("ContactEmail").Column)), Cells(crow, _
    Range("ContactEmail").Column).Value) = 1 Then

Dom
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,286
Members
449,076
Latest member
kenyanscott

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