Hi All, I am try to loop a column of email address in a file, but the email address appear in the column by using an vlookup, I can do the VBA using one cell at a time and it will pick up the vlookup email and work ok but when I try it with a column of email address using the vlookup it will not work I have to copy and paste special values the email address and it works ok
Thanks Tom90
----------------------------------------------------------------------------
Mod Edit: Code Tag!
Thanks Tom90
Code:
Sub TestNew()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Columns("J").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And _
LCase(Cells(cell.Row, "K").Value) <> "sent" Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Reminder"
.Body = "Dear " & Cells(cell.Row, "H").Value _
& vbNewLine & vbNewLine & _
"Please contact us to discuss bringing " & _
"your account up to date."
.Send
End With
On Error GoTo 0
Cells(cell.Row, "K").Value = "sent"
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
----------------------------------------------------------------------------
Mod Edit: Code Tag!
Last edited by a moderator: