1 2 3 4 5 6 7 8 9 10 11 12
| Private Sub worksheet_change(ByVal target As Range)
If target.Column >= 1 And target.Column <= 3 And target.Count = 1 Then
If target <> "" Then
Range("A2:E1000").Sort Key1:=Range("B3"), Order1:=xlAscending, Key2:=Range("A3") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
End If
Range("A1:E10000").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("H1"), Unique:=True
Range("A1:E10000").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("J1:K1"), Unique:=True
End If
End Sub |
Partager