title: excel vba nested for each loop
body: <p>I am working on excel macro and got stuck at one point. Need help to please resolve it.</p>
  
  <p>I have to look for 2 rows in sheet, and for each value in 1 row look for the cell value in 2 row. If the range of values in row 2 equal to some conditional value, then come out of the  row 2 check and set the flag as true.  For achieving this I used two <code>For Each</code> loop: </p>
  
  <pre><code> Sub Sendmail ()
      For Each cell in Rows("5").Cells.SpecialCells(xlCellTypeConstant)
          If cells.Value Like "*@*" Then
              Subj = "Fill the Sheet"
              Recipient = cell.Offset(0,-3).Value
              EmailAddr = cell.Offset.Value
              For Each row In Sheet14.Range("O244:AK244").Cells
                  If Not row = '8.00" Then
                      found = False
                  Else
                      found = True
                  End If
              Next row
              If found = False Then
                  Msg = "Hi " &amp; Recipient &amp; vbCrLf &amp; vbCrLf
                  Msg = Msg &amp; " Please fill the sheet for this week " &amp; vbCrLf &amp; vbCrLf
                  Set MItem = Outlook.CreateItem(oIMailItem)
                  With MItem  
                      .To = EmailAddr
                      .Subject = Subj
                      .Body = Msg
                      .Save
                  End With
              End If
          End If
      Next
  End Sub
  </code></pre>
  
  <p>The <code>found</code> variable used here is defined as Boolean , but I am not able to use it properly, and every time <code>found = false</code> is executing . I want only once the condition is true for row 2, then only the mail should be created .</p>