title: loop through cell a looking for match within col b
body: <p>Loop through a column worksheet1 a2:a and if theres match in worksheet2 column a2:a then offset found within worksheet1 b2:b if found else not found. I have mashed up some code but might have confused myself. I'm looking for clarity on my answer.</p>
  
  <pre><code>  Dim r1 As Range
  Dim r2 As Range
  Dim i As Integer
  Dim lookupArray As Variant
  Dim lookupVal As Variant
  Dim matchResult As Variant
  Dim rowIndex As Long
  Dim e1 As Integer
  Dim e2 As Integer
  
      r1 = r1.Range("A2:A").Cells
      r2 = r2.Range("B2:B").Cells
  
      e1 = Cells(Rows.Count, "A").End(xlUp).Row 'Range("A" &amp; Cells.Rows.Count).End(xlUp).Offset(1,0).Select
      e2 = Cells(Rows.Count, "B").End(xlUp).Row
  
              For rowIndex = r1 To e1
              Set lookupVal = Range(r2 &amp; rowIndex)
  
              matchResult = Application.match(lookupVal, r1, 0)
  
              If r1.cell(i, 1).Value = r2.cell(i, 1).Value And Not IsEmpty(Cells(i, 1).Value) Then
                    r1(i, 1).Offset(0, -1).Value "Found"
                    Else
                    r1(i, 1).Offset(0, -1).Value "NotFound"
                    End If
                  'copy found cells in sheet 3
              Next rowIndex
  </code></pre>