Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Sending data from a column to another column with email addresses

0

I have 2 columns. 1 with data/codes (AEB23 for example) and another with email addresses. Each code is meant to be sent to the corrosponding email next to it. 

I have more than 400 rows of codes. Is there a way where I can send these codes quickly and efficiently rather than sending them individually over outlook which will take forever and more than 400 emails.

Answer
Discuss

Discussion

Yes there is. But you will have to find the code on the web yourself. Come back here if you have a problem implementing the code you found.
Variatus (rep: 4889) May 18, '20 at 8:50 am
Add to Discussion

Answers

0

Hello, Amr Elb

Maybe this code can hepl you. Try it.

Dim i As Integer

Sub envio()

    Dim n As Integer 
    n = Application.WorksheetFunction.CountA(Range("A:A"))

    For i = 2 To n 
       macro (i)
    Next

End Sub

Sub mail(i)

    Dim emailApp As Object
    Dim emailItem As Object

    Set emailApp = CreateObject("Outlook.Application")
    Set emailItem = emailApp.CreateItem(0)

    emailItem.To = Cells(i, 6)                 'email addres are in column F
    emailItem.Subject = Cells(i, 7)         'subject of the mail are in column G
    emailItem.Body = Cells(i, 1)             'message of the mail are in column A
    emailItem.Send

End Sub

I hope this be usefull

Regards
Basilio

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login