title: How to send email via Excel when the value of cell is "Yes"
body: <p>I have an Excel table and a bit of macro. I wanted to automatically send email to a certain person when cell value == to "Yes".  Also I want to send the email only if the date is today.</p>
  
  <p>Please see screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/qanl3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qanl3.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/FF0d1.png" rel="nofollow noreferrer">Error Screenshot Sir</a></p>
  
  <pre><code>Private Sub cmdMove_Click()
  
  
      'Sub TestFile()
      Dim OutApp As Object
      Dim OutMail As Object
      Dim cell As Range
  
      Application.ScreenUpdating = False
      Set OutApp = CreateObject("Outlook.Application")
  
      On Error GoTo cleanup
      For Each cell In Columns("J").Cells.SpecialCells(xlCellTypeConstants)
          If cell.Value Like "?*@?*.?*" And _
             LCase(Cells(cell.Row, "H").Value) = "Yes" Then
  
              Set OutMail = OutApp.CreateItem(0)
  
              On Error Resume Next
  
              With OutMail
                  .To = ThisWorkbook.ActiveSheet("Server").Range("I3").Value
  
                  .Subject = "Reminder"
  
                  .Body = "Dear " &amp; Cells(cell.Row, "Ryan").Value _
                        &amp; vbNewLine &amp; vbNewLine &amp; _
                          "Please contact us to discuss bringing " &amp; _
                          "your account up to date"
                  'You can add files also like this
                  '.Attachments.Add ("C:\test.txt")
                  .Send  'Or use Display
              End With
              On Error GoTo 0
              Set OutMail = Nothing
          End If
      Next cell
  
  cleanup:
      Set OutApp = Nothing
      Application.ScreenUpdating = True
  End Sub
  
  End Sub
  </code></pre>