Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate Records JillC Excel Discussion (Misc queries) 2 January 21st 10 07:31 PM
KEEP duplicate records Shon Excel Discussion (Misc queries) 3 November 25th 09 02:08 PM
Delete records when certain records have duplicate column data JVroom New Users to Excel 1 January 26th 09 06:23 PM
duplicate records Zack Excel Discussion (Misc queries) 1 August 22nd 08 08:24 PM
duplicate records rcarlo Excel Discussion (Misc queries) 1 December 11th 07 11:30 PM


All times are GMT +1. The time now is 09:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"