Quote Originally Posted by cdurfey View Post
I am writing a code to send an email from excel using the name in column AR. I have the following code but it will only pull the 1st name it comes to. I need it to pull all of the names. There will be some names that are repeated so I would like for it to pull each name only once if that is possible. Thanks

Dim OutApp As Object
Dim OutMail As Object
Dim Recipients As String, c As Range
Set r = Range("AR2")
For Each c In r

Recipients = ";" & c.Value
Next c
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
Try replacing the line of code I highlighted in red above with this...
Code:
If InStr(Recipients & ";", ";" & c.Value & ";") = 0 Then Recipients = Recipients & ";" & c.Value
Note: After the loop has finished, the Recipients variable will start with a semi-colon... you can remove it by placing this line of code after the Next statement...
Code:
Recipients = Mid(Recipients, 2)