View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default Compare identifier columns from 2 sheets - remove rows that aredups

hi Livin,

Sub test()
With Sheets("Sheet2")
For i = .Range("A65536").End(xlUp).Row To 1 Step -1
If Not IsError(Application.Match(.Range("A" & i), Sheets("Sheet1").Range("A:A"), 0)) Then
.Rows(i).Delete Shift:=xlUp
End If
Next
End With
End Sub

--
isabelle



Le 2012-05-04 19:35, Livin a écrit :
I have two sheets with thousands of rows. I need to remove rows from the 2nd
sheet that have the same identifier as rows in the first sheet... so there are
no duplicates.

Example...

'Sheet1'

ddd1234<several data columns
ddd1234<several data columns
abc1234<several data columns
wrd1234<several data columns
wrd1234<several data columns



'Sheet2'

ddd1234<several data columns
abc1234<several data columns
wrd1234<several data columns
www1234<several data columns
ggg1234<several data columns


... yes, Sheet1 may have multiple rows with the same identifier but that does
not matter... I just want to remove rows from Sheet2 anything that matches IDs
from Sheet1 - I don't care about consolidating or removing dups from Sheet1.

thx for the help!