Sub TAB_LegSelect()
Dim Derlig&, Derlig2&
Derlig = Sheets("LegSelect").Range("A" & Rows.Count).End(xlUp).Row
If Derlig <= 2 Then Derlig = 2
Sheets("LegSelect").Range("A2:F" & Derlig).Clear
With Sheets("ListTotalLeg")
.AutoFilterMode = False
Derlig2 = .Range("A" & Rows.Count).End(xlUp).Row
.Range("A1:E1").AutoFilter
.Range("$A$1:$E$" & Derlig2).AutoFilter Field:=5, Criteria1:="x"
.Range("$A$2:$C$" & Derlig2).SpecialCells(xlCellTypeVisible).Copy Destination:=Sheets("LegSelect").Range("A2")
.AutoFilterMode = False
End With
End Sub