title: VBA code to send personalized email from excel
body: <p>I would like to have a code that will send emails using excel table as source. email addresses are in the table, however they are duplicates.</p>
  
  <p>I found a code that generates and email for every row/line, but i need it to generate an email for multiple rows that contain same email address.</p>
  
  <p><strong>PLEASE!</strong> Modify the code so that it will generate only <strong>1</strong> email from multiple rows that contain same email address.<br>
  *I would do it myself but i do not know how because i do not know how to code in VBA.</p>
  
  <p>The code i have so far is and it generates email for EVERY line, which is not what i am looking for:</p>
  
  <pre><code>Sub email()
  Dim i As Long
  Dim OutApp, OutMail As Object
  Dim strto, strcc, strbcc, strsub, strbody As String
  
  Set OutApp = CreateObject("Outlook.Application")
  OutApp.Session.Logon
  
  For i = 1 To Range("c65536").End(xlUp).Row
  Set OutMail = OutApp.CreateItem(0)
  
      strto = Cells(i, 8)
      strsub = "Missing Books"
      strbody = "Good day," &amp; vbNewLine &amp; _
          "We are missing below books:" &amp; vbNewLine &amp; _
          Cells(i, 1) &amp; Chr(32) &amp; Cells(i, 2) &amp; Cells(i, 3) &amp; Cells(i, 5) &amp; Cells(i, 6) &amp; vbNewLine &amp; vbNewLine &amp; _
          "brgds," &amp; vbNewLine &amp; _
          "Alex"
  
      With OutMail
          .To = strto
          .Subject = strsub
          .Body = strbody
          '.Send
          .display
  
      End With
      On Error Resume Next
  
  Next
  
  Set OutMail = Nothing
  Set OutApp = Nothing
  End Sub
  </code></pre>
  
  <p>The final email for email address should look like this:  </p>
  
  <blockquote>
    <p>to: test@email.com<br>
    subject: Report!<br>
       Hello!   </p>
    
    <p>Here is the overview of the used service:</p>
    
    <p>Period / Number / Company/ Count / Duration * <em>header row</em><br>
    201504 / 900654 / ETV / 5 / 89 / * <em>data row, includes email in column H</em><br>
    201504 / 900098 / ETV / 2 / 24 / * <em>data row, includes email in column
    H</em> </p>
    
    <p>Best wishes,    Annu</p>
  </blockquote>
  
  <p>NOTE: First row is the header row and starting from second row are the data cells. They come from a table as does the emails<br>
  NOTE: H is the Column for emails - there can be 10 times/lines test@email.com and it needs only 1 email but with the information that comes prior the email cell itself.</p>
  
  <p>Edit*
  <a href="http://i.stack.imgur.com/7C6eu.png" rel="nofollow">This is the table</a></p>