title: For loop on unique ID
body: <p>Sheet1 is a continuous list of everything being recorded and kept.<br />
  Sheet2 is an updated list that is retrieved, with updated lines and new lines. Within the lists in column A is a unique ID for every entry in numeric value.</p>
  <p>I am trying to go through every unique ID in sheet2, look for a match in sheet1</p>
  <ul>
  <li>if there is a match, replace that entire row values with the new values from sheet2</li>
  <li>if there is no match it needs to be placed in the last blank row (+1 from xlUp).</li>
  </ul>
  <p>I have tried other ways that are not below like using scripting.dictionary.</p>
  <p>The way I am trying to do this results in every cell that the “for” is looking at to be true for the if not equal. Every item is posted multiple times below xlUp.</p>
  <pre class="lang-vb prettyprint-override"><code>Sub test()
  
  Dim enter As Worksheet
  Dim take As Worksheet
  Set enter = Worksheets(&quot;Sheet1&quot;)
  Set take = Worksheets(&quot;Sheet2&quot;)
  
  Dim a1 As Long
  Dim b1 As Long
  Dim c1 As Long
  
  a1 = take.Cells(Rows.Count, 1).End(xlUp).Row
  b1 = enter.Cells(Rows.Count, 1).End(xlUp).Row
  c1 = enter.Cells(Rows.Count, 1).End(xlUp).Row + 1
  
  For i = 1 To a1 'this statement works fine to find the matching value to replace.
      For K = 1 To b1
          If take.Cells(i, 1) = enter.Rows(K, 1) Then
              enter.Rows(i).EntireRow = take.Rows(K).EntireRow.Value
          End If
      Next
  Next
  
  'below is other things i have tried
  
  'For I = 1 To a1
  '    For J = 1 To b1
  '        If enter.Cells(J, 1) &lt;&gt; take.Cells(I, 1) Then
  '            enter.Rows(c1).EntireRow = take.Rows(I).EntireRow.Value
  '            c1 = c1 + 1
  '        End If
  '    Next
  'Next
  
  'For i = 1 To a1
  '    For j = 1 To b1
  '        If take.Cells(i, 1) = enter.Cells(j, 1) Then
  '            enter.Rows(j).EntireRow = take.Rows(i).EntireRow.Value
  '            GoTo Skip
  '        ElseIf j = b1 Then
  '            enter.Rows(c1).EntireRow = take.Rows(i).EntireRow.Value
  '            c1 = c1 + 1
  '        End If
  '    Next
  'Skip:
  'Next
          
  End Sub
  </code></pre>