Option Explicit
Sub Macro4()
Dim ws1 As Worksheet, _
ws2 As Worksheet, _
ws3 As Worksheet, _
lst1 As Integer, _
lst2 As Integer
Set ws1 = Sheets("Sheet1")
Set ws2 = Sheets("Sheet2")
Set ws3 = Sheets("Sheet3")
lst1 = ws1.Cells(65536, "A").End(xlUp).Row
lst2 = ws2.Cells(65536, "A").End(xlUp).Row
ws1.Range("A1:F" & lst1).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=ws2.Range("A1:A" & lst2), _
CopyToRange:=ws3.Columns("A:F"), Unique:=True
End Sub
|