![]() |
Duplicate records
I am entering data into a worksheet from another worksheet. On the data
entry sheet the record is unique because of the date and shift. Shift can be 3 different values. I need to be able to check for duplicates in the database sheet. The date and shift are in different columns. I need to check both of these columns so as not to enter duplicate records. |
Duplicate records
Sounds like 'delete rows in column A if not in column B' to me:
Sub Redundancy() Dim iLastRow As Long Dim i As Long iLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = iLastRow To 2 Step -1 If IsError(Application.Match(Cells(i, "A").Value, _ Range("B:B"), 0)) Then Cells(i, "A").Delete Shift:=xlUp End If Next i End Sub Save a copy of your file and run this macro on the copy. It would be bad to run this on your actual data and (only then) realize that the result was not what you expected. Regards, Ryan--- -- RyGuy "Enyaw" wrote: I am entering data into a worksheet from another worksheet. On the data entry sheet the record is unique because of the date and shift. Shift can be 3 different values. I need to be able to check for duplicates in the database sheet. The date and shift are in different columns. I need to check both of these columns so as not to enter duplicate records. |
All times are GMT +1. The time now is 11:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com