Email List of People from Excel Using a Macro

Add to Favorites

Send emails to everyone in a list in Excel using a macro. The message for the email can either come from another column in the list and be unique for each email or be the same for each email.

The emails will be sent through Microsoft Outlook, so you must also have that program setup on your computer.

Sections:

The Macro

Edit the Macro

The Macro

The macro pulls the email addresses from column A and the message text from column B.

It assumes that the email list starts in row 1; to change this, go to the section below the macro that explains how to edit it.

Sub Send_Email_to_List()

Dim OL As Object, MailSendItem As Object
Dim MsgTxt As String

Set OL = CreateObject("Outlook.Application")

For Each xCell In ActiveSheet.Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))

    user_email = xCell.Value
    user_subject = "Subject Line for the Email"
    user_msg = Cells(xCell.Row, 2).Value

    Set MailSendItem = OL.CreateItem(olMailItem)

    With MailSendItem
        .Subject = user_subject
        .Body = user_msg
        .To = user_email
        .Send
    End With

Next xCell

Set OL = Nothing

End Sub

Edit the Macro

Change the Email List

Range("A1"), Range("A" & Rows.Count).End(xlUp)

Change A1 to the cell that starts the email list. If you change from column A to another column, also change "A" to the letter of the column with the list.

If the email list is in a pre-defined range, you can replace the bold text above with a simple range input like this: "A1:A100" and that tells the macro that the emails are contained in cells A1 to A100.

The original code will start from the first cell in the list, A1, and go to the very last cell in that column that has data.

Change the Subject Line

"Subject Line for the Email"

Change the above piece of code to whatever you want to be in the subject.

You can even get the value from the spreadsheet if you want, just reference the cell in the same way that the message body text is referenced.

Change the Message Body Text

Cells(xCell.Row, 2).Value

This piece of code tells the macro to get the body text of the email from column B in the same row as the email address.

To change the column from which the text is gotten, simply change 2 to the number of the desired column; A is 1, B is 2, etc.

To change this to a generic message for each user, simple reference the cell that contains the generic message like this: Range("A1").Value and the message will be taken from the specified cell.

You could also replace the code with text directly in the macro like this: "This is the email message."

ecf6ea55918e3484392d1c516d0ec85c.jpg





How to Install the Macro
  1. Select and copy the text from within the grey box above.

  2. Open the Microsoft Excel file in which you would like the Macro to function.

  3. Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.  Or For other ways to get there, Click Here.

  4. On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.

  5. If the Macro goes in a Module, Click Here, otherwise continue to Step 8.

  6. If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.

  7. If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.

  8. Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.

  9. You are now ready to run the macro.


Subscribe for Free Excel tips & more!
E-mail: