I have an Excel Workbook with the 2 sheets.
Sheet 1 contains an Email template and sheet 2 contains the raw data.
Sheet 2 contains the headers as mentioned below. Name ERP Employee Date Email Start Date Is Anniversary(Yes/No) Years Completed
In Sheet 1, I have created a drop-down list where the list will contain the names of the Employees who have the Is Anniversary field (yes)
I have written a VBA script to send an Email to the person who is selected in the drop-down list.
I would like to make it fully automated where the script should be able to select the next value automatically and then send the Email to the person and likewise for the whole list. Please suggest if there is a possibility.
Script for sending the Email
Sub Send_Anniversary_Email()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Mailer")
Dim lr As Integer
lr = sh.Range("J" & Application.Rows.Count).End(xlUp).Row
sh.Range("E5:L" & lr).Select
With Selection.Parent.MailEnvelope.Item
.to = sh.Range("B12").Value
.cc = sh.Range("B13").Value
.Subject = sh.Range("B14").Value
.send
ActiveWorkbook.Save
End With
MsgBox "Done"
End Sub