Duplicate records

E

Enyaw

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.
 
R

ryguy7272

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---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top