I have a workbook that is used to calculate data. There is a range on the workbook "P2:T2" that needs to be copied and pasted to a log as a record that it has been used. My problem is I don't want duplicate data on the pasted workbook. Is there a way to look for if there is already repeat data based on cell P2 to not paste the data?
Here is my current code (I removed the location of the second workbook). This works but will paste the data every time the calculator workbook is used, I only want one entry per P2 value:
Sub Data_Tracking()
' copy data
Range("P2:T2").Copy
' open test workbook
Workbooks.Open "location.test.xlsx"
' paste data
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
' save and close test workbook
Workbooks("Test.xlsx").Close SaveChanges:=True
End Sub
Here is my current code (I removed the location of the second workbook). This works but will paste the data every time the calculator workbook is used, I only want one entry per P2 value:
Sub Data_Tracking()
' copy data
Range("P2:T2").Copy
' open test workbook
Workbooks.Open "location.test.xlsx"
' paste data
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
' save and close test workbook
Workbooks("Test.xlsx").Close SaveChanges:=True
End Sub