View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Delete records from 1 list that are in another?

Hi Aaron,

Assume your two ranges are named Master and Extract, try:

Sub Tester()
Dim rCell As Range
Dim rng1 As Range
Dim rng2 As Range

Application.ScreenUpdating = False

Set rng1 = Range("Master")
Set rng2 = Range("Extracted")

For Each rCell In rng1.Columns(2).Cells
If Not IsError(Application.Match _
(rCell.Value, rng2.Columns(2).Cells, 0)) Then
rng1.Resize(1, rng1.Columns.Count).Delete shift:=xlUp
End If
Next
Application.ScreenUpdating = True
End Sub


---
Regards,
Norman



"astockley2005"
wrote in message
news:astockley2005.1rpq6u_1120594032.0823@excelfor um-nospam.com...

Hi All. I have two lists. the first is the "master" and the second is
the extracted. I would like to know the vba code to delete the
extracted from the master list.
Each list has two columns. the first contains the date and the second
contains a unique ID number.
The extracted list is updated everyday and I want the master list to
become shorter and shorter. any ideas?
thanks in anticipation!

Regards

Aaron Stockley


--
astockley2005
------------------------------------------------------------------------
astockley2005's Profile:
http://www.excelforum.com/member.php...o&userid=24929
View this thread: http://www.excelforum.com/showthread...hreadid=384648