So this code will clear what's in sheet3, then it will filter sheet2 and paste the results to sheet3. Sheet3 will not have any blanks.
Let me know how that works for you.
FYI the selection change event that you chose to run this code triggers when you select a cell other than the one that is already selected. If A2 is already selected you would have to click into another cell and then back into A2 to get it to run. If this is not the behavior you want then there's probably a better way to run the code, a button or another event.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address(0, 0) <> "A2" Then Exit Sub
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
With Worksheets("Sheet2").Range("$A:$I")
.AutoFilter Field:=2, Criteria1:="=*71", _
Operator:=xlAnd, Criteria2:="<>*D*"
Worksheets("Sheet3").UsedRange.ClearContents
.Copy Worksheets("Sheet3").Range("A1")
.AutoFilter
End With
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub
Bookmarks