hi all,
I have the following code:
It is designed to take the value from the 'iCounter row' in Col.G of Sheet3 and search Col.G of Sheet2 for it. If it doesn't match, the whole row in sheet3 is then copied to the last row of sheet2.
this works reasonably well for rows where a duplicate in Col.G of sheet 3 (actually an order number) is not found, however if a duplicate (two rows with the same order number) exists in sheet3 - for example split orders, or multiple items/suppliers for one order - the code only 'sees' the first instance in Sheet2 and so won't copy any addtional rows for duplicate order numbers and simply moves the iCounter to the next row on Sheet3.
can anyone help with this please??
I have the following code:
Code:
For iCounter = 9 To iLast
Set rng1 = ws.Range("G9:G5000").Find(ws2.Range("G" & iCounter).Value)
If rng1 Is Nothing Then
ws2.Range("A" & iCounter & ":" & "K" & iCounter).Copy
ws.Range("A" & ws.Range("A" & Application.Rows.Count).End(xlUp).Row + 1).PasteSpecial xlPasteAll
End If
Next iCounter
It is designed to take the value from the 'iCounter row' in Col.G of Sheet3 and search Col.G of Sheet2 for it. If it doesn't match, the whole row in sheet3 is then copied to the last row of sheet2.
this works reasonably well for rows where a duplicate in Col.G of sheet 3 (actually an order number) is not found, however if a duplicate (two rows with the same order number) exists in sheet3 - for example split orders, or multiple items/suppliers for one order - the code only 'sees' the first instance in Sheet2 and so won't copy any addtional rows for duplicate order numbers and simply moves the iCounter to the next row on Sheet3.
can anyone help with this please??
Last edited: