title: Excel VBA send Mail if value is "no"
body: <p>In my excel file i have a table which look like this:</p>
  
  <pre><code>|Name|   Mail Address   | Return|
  |ABC | abc@example.com  |   no  |
  |DEF | def@example.com  |  yes  |
  |GHI | ghi@example.com  |   no  |
  </code></pre>
  
  <p>Now i want to send a E-Mail with VBA to every one in the Table which has the value "No" in column "Return" (C).</p>
  
  <p>My Code looks like this:</p>
  
  <pre><code>Private Sub CommandButton2_Click()
  
      Dim OutApp As Object
      Dim OutMail As Object
      Dim nameList As String
  
      Set OutApp = CreateObject("Outlook.Application")
      Set OutMail = OutApp.CreateItem(0)
      On Error GoTo cleanup
  
      For i = 2 To 22
          If Sheets("SHEETNAME").Range("C2:C22").Value = "no" Then
              nameList = nameList &amp; ";" &amp; Sheets("SHEETNAME").Range("B" &amp; i).Value
          End If
      Next
          .To = nameList
          .Subject = "Friendly Reminder"
          .Body = "Text"
      End With 
  
  cleanup:
      Set OutApp = Nothing
  
  End Sub
  </code></pre>
  
  <p>The Code sends the mail, but it sends it to all people in the list. How can i solve this problem that only the people with the value "no" will receive the mail?</p>
  
  <p>Thanks for your help</p>