View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
flummi
 
Posts: n/a
Default Matching two spreadsheets

Try this in a command button:

Set rng1 = Range("range1")
Set rng2 = Range("range2")
rcnt1 = rng1.Rows.Count
rcnt2 = rng2.Rows.Count
For rc1 = 1 To rcnt1
foundit = False
For rc2 = 1 To rcnt2
If rng1.Cells(rc1, 1).Value = rng2.Cells(rc2, 1).Value
Then
foundit = True
GoTo nextrng1
End If
Next rc2
If Not foundit Then
' rng1.Cells(rc1, 2).Value = "delete"
rng1.Cells(rc1, 1).Delete shift:=xlShiftUp
rcnt1 = rcnt1 - 1
End If
nextrng1:
Next rc1
MsgBox ("done.")


But test it first!

Hans