1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("Tableau5")) Is Nothing Then ' si la cellule modifiée fait partie du tableau5
Application.ScreenUpdating = False ' pour éviter que le tableau "clignote" on arrête la mise à jour de l'écran
ActiveWorkbook.Worksheets("Congé Annuels").ListObjects("Tableau5").Sort.SortFields. _
Clear ' supprime les filtres éventuels
ActiveWorkbook.Worksheets("Congé Annuels").ListObjects("Tableau5").Sort.SortFields. _
Add Key:=Range("Tableau5[[#All],[Date :]]"), SortOn:=xlSortOnValues, Order _
:=xlAscending, DataOption:=xlSortNormal ' tri par ordre croissant sur la colonne date (colonne A)
With ActiveWorkbook.Worksheets("Congé Annuels").ListObjects("Tableau5").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Application.ScreenUpdating = True ' on remet en marche la mise à jour de l'écran
End If
End Sub |