Two columns, separate sheets, each have part number in them. Column1 is updated and Column2 is copied from Column1 before Column1 is updated to retain associated row values and information per part number. Now if Column1 is updated and the row counts between Column1 and Column2 don't match anymore, I cannot find anything on comparing columns with different row counts where duplicates occur. How can I compare the columns and if there is a duplicate, take the duplicate row from Column2 and copy it to Column1 where the duplicate occurred(same part number)? Like if before Column1 was updated there was a part number 2222 in cell A1, so that data would be copied over to Column2 to A1. After the update of Column1 the part number 2222 might be in A8 now. Now the row counts don't match between columns, so I cannot do row count, and I cannot just copy a range over from one sheet to the other. Any help would be much appreciated.
Sub DeleteRowsandCopyRowstoduplicate()
'Deletes rows where one cell does not meet criteria
Dim ws1 As Worksheet: Set ws1 = ActiveWorkbook.Sheets("machine schedule")
Dim ws2 As Worksheet: Set ws2 = ActiveWorkbook.Sheets("Sync Data")
Dim criteria As String
Dim found As Range
Dim i As Long
Application.ScreenUpdating = False
For i = 60 To 3 Step -1
criteria = ws2.Cells(i, 1).Value
On Error Resume Next
Set found = ws1.Range("A:A").Find(What:=criteria, LookAt:=xlWhole)
On Error GoTo 0
If found Is Not Nothing Then
ws2.Cells(i, 1).EntireRow.Copy Destination:= '**not sure what to put here because it's always changing
If found Is Nothing Then
ws2.Cells(i, 1).EntireRow.ClearContents ' or .Delete
End If
Next i
Application.ScreenUpdating = True
End Sub