Hi guys,
Apologies if the following explanation is a bit dodgy - first post...
Essentially I have a load of data, Column E has a timestamp, column Q a contract version number and column S a contract number.
If a trade has been amended there will be 2 rows with the same contract number but a later version no and a different timestamp. I am looking to copy the timestamp from version 1 on to the latest version no. and then delete all previous versions.
So far I have the following which keeps only the most recent version, but need to somehow copy the timestamp in row E on to all duplicates (or just the most recent) before erasing the previous versions...
Sub DeletDuplicate()
Dim x As Long
Dim LastRow As Long
LastRow = Range("S65536").End(xlUp).Row
For x = LastRow To 1 Step -1
If Application.WorksheetFunction.CountIf(Range("S1:S" & x), Range("S" & x).Text) > 1 Then
Range("S" & x).EntireRow.Delete
End If
Next x
End Sub
Any help is greatly appreciated.
Thanks
Moderator's Note: Welcome to the forum. You have to put code tags around codes. Select the code then hit the "#" sign. I'll do it for you now. Thank you.
Bookmarks