Only running an action once per entry

bruty

Active Member
Joined
Jul 25, 2007
Messages
456
Office Version
  1. 365
Platform
  1. Windows
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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Just wondering if anyone had been able to put their finger on the problem yet?
 
Upvote 0
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
Seems to have done the trick - many thanks for your help and patience with this :)
 
Upvote 0

Forum statistics

Threads
1,215,442
Messages
6,124,886
Members
449,194
Latest member
ronnyf85

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