I have this code here that copies, and pastes from one sheet to another if the match is not found. However, I cant seem to get the row counter to reset to the top of the row. Once it is done looping through a row, it should reset to the second row (as the first row will be a header row). Furthermore, if the code finds a match on any of the new sheets it has to delete the existing entry, and replace it in the sheet that I am pasting to. I have my code below. Can someone please help? Thanks.
VBA Code:
Sub FindMissingProductsAndCopyThem1()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
'define which worksheet
Set ws2 = ThisWorkbook.Worksheets("BOM")
Dim lRowSource As Long
Dim lRowDestination As Long
lRowDestination = ws2.Cells(ws2.Rows.Count, 1).End(xlUp).row 'find last row in column D
Dim FoundRow As Long
Dim iRow As Long
Dim iCol As Long
For Each ws1 In ActiveWorkbook.Worksheets
If ws1.Name Like "Revision *" Then
lRowSource = ws1.Cells(ws1.Rows.Count, 1).End(xlUp).row 'find last row in column A
lColumnSource = ws1.Cells(1, Columns.Count).End(xlToLeft).Column
For iCol = 1 To lColumnSource
For iRow = 2 To lRowSource
FoundRow = 0 'initialize/reset
On Error Resume Next 'next line throws an error if not matched, catch that error
'try to find/match the data of column A in column D
FoundRow = Application.WorksheetFunction.Match(ws2.Cells(iRow, iCol), ws1.Columns(iCol), 0)
On Error GoTo 0 're-activate error reporting
'if Match threw an error, then FoundRow is still 0
If FoundRow = 0 Then 'product was not found, so add it
c = Columns(iCol).Column
lRowDestination = lRowDestination + 1
ws2.Cells(lRowDestination, iCol).Value = ws1.Cells(iRow, iCol)
'If iCol = iCol - 1 Then
'lRowDestination = Cells(Rows.Count, c).End(xlUp).row
'End If
End If
Next iRow
Next iCol
End If
Next ws1
End Sub