1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
' La variable KeyCells contient la colonnes qui déclenchera LE TRI si elle est renseignée.
Set rng = Range("U:U")
If Not Application.Intersect(rng, Range(Target.Address)) Is Nothing Then
'Tri par année puis par n° de FP
Application.Goto Reference:="Tab_FP"
ActiveWorkbook.Worksheets("Fiche de Progres").ListObjects("Tab_FP").Sort. _
SortFields.Clear
ActiveWorkbook.Worksheets("Fiche de Progres").ListObjects("Tab_FP").Sort. _
SortFields.Add Key:=Range("Tab_FP[Annee des F.P pour tri colonne A]"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
ActiveWorkbook.Worksheets("Fiche de Progres").ListObjects("Tab_FP").Sort. _
SortFields.Add Key:=Range("Tab_FP[N° F.P]"), SortOn:=xlSortOnValues, Order _
:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Fiche de Progres").ListObjects("Tab_FP").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'Modif format des dates en Français
Range("H2:I22,M2:M22").Select
Range("H2:I22,M2:M22,O2:O22,Q2:Q22").Select
Selection.NumberFormat = "m/d/yyyy"
End If
End Sub |
Partager