title: Excel VBA FOR loop with IF statement to match with data in another column and append a seperate column
body: <p>So I have two columns of name data with the second matching the first only sparingly. I'd like to create an iterator that loops through the first column and the second column simultaneously and, upon finding a match, appends a different column, of the same row, with a specific phrase.</p>
  
  <p>Data looks similar to this</p>
  
  <pre><code>Row 1             Row 2            Row 3
  
  Kyle Hammer                        John Doe
  John Doe                           Gary Wilson
  Bill Walter
  Gary Wilson
  
  </code></pre>
  
  <p>I'm pretty new to VBA. Done a lot of javascript but never had to work with excel. I tried the code below but keep getting a run time error 424?</p>
  
  <pre><code>Sub Iterator()
  '
  ' Iterator Macro
  '
  Set dbsheet2 = ThisWorkbook.Sheets("Sheet1")
  
  lr1 = dbsheet2.Cells(Rows.Count, 1).End(xlUp).Row
  lr2 = dbsheet2.Cells(Rows.Count, 4).End(xlUp).Row
  
  For x = 1 To lr1
      act1 = dbsheet2.Cells(x, 1)
  
      For y = 1 To lr2
          act2 = dbsheet1.Cells(y, 1)
  
          If act2 = act1 Then
              dbsheet2.Cells(y, 6).Value = "Match"
  
          Else
              dbsheet2.Cells(y, 6).Value = "Nothing here for me Dawg"
          End If
      Next y
  Next x
  End Sub
  
  </code></pre>
  
  <p>I'm hoping to simply write "match" to column 6 when there is a match between the names in column 1 and 3.</p>