title: Copy row from excel worksheet to another if no match
body: <p>I have an Excel worksheet ("All Documents") that is populated from a SharePoint list but also has some columns that contain formulas. I have another worksheet in the same workbook ("Original") that contains the original values of the list items. I need to compare the two worksheets and if the value in column A in "All Documents" does not exist in column A in "Original" it needs to copy the row to the "Original" sheet. It must be pasted as values. I have searched many forums and tried many suggestions but none worked. This is my latest attempt. Any assistance will be appreciated!</p>
  
  <pre><code>Dim x As Long, y As Long, a As Long
  Dim b As String
  Dim rFound As Range
  Dim TargetRange As Range
  x = Worksheets("All Documents").Range("A" &amp; Rows.Count).End(xlUp).Row
  For a = 2 To x
      y = Worksheets("Original").Range("A" &amp; Rows.Count).End(xlUp).Row
      b = Worksheets("All Documents").Range("A" &amp; a)
      If a &gt; y Then Exit For
      With Worksheets("Original").Range("A:A")
          Set rFound = .Find(b, LookIn:=xlValues)
          If rFound Is Nothing Then
             TargetRange = Worksheets("Original"1).Cells(Worksheets("Original").Rows(y + 1))
             Worksheets("All Documents").Rows(a).Copy
             TargetRange.PasteSpecial xlPasteValues
          End If
      End With
  Next a
  </code></pre>