Hi,
I have the below listed code that is working alright to copy the existing data from one sheet and paste the records into another one:
What I need help with is how to add a command that will find out if there's a same record existing and just overwrite it without adding a new column in next blank cell in the column.
For example, if a data from "Invoice" sheet cell M16 is existing number in "Bill" sheet Column A, then just overwrite existing one, if it doesn't exists, create a new row.
Currently, the below code just creates a new row.
I have the below listed code that is working alright to copy the existing data from one sheet and paste the records into another one:
What I need help with is how to add a command that will find out if there's a same record existing and just overwrite it without adding a new column in next blank cell in the column.
For example, if a data from "Invoice" sheet cell M16 is existing number in "Bill" sheet Column A, then just overwrite existing one, if it doesn't exists, create a new row.
Currently, the below code just creates a new row.
Code:
Sub InvoiceCopy()
' This code copies the Invoice Data and Paste it to Bill Tab
Sheets("Invoice").Select
Range("M16:O16").Select
Selection.Copy
Sheets("Bill").Select
lMaxRows = Cells(Rows.Count, "A").End(xlUp).Row
Range("A" & lMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A8").Select
End Sub
Last edited by a moderator: