Sub Macro1()
Dim DerLig As Long
' Avec la feuille Notes
With Sheets("Notes")
' Trouver la dernière ligne remplie dans la colonne C
DerLig = .Range("C" & Rows.Count).End(xlUp).Row
' Effacer le tri
.Sort.SortFields.Clear
' Faire le tri par date de la colonne A
.Sort.SortFields.Add Key:=Range("A3"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With .Sort
.SetRange Range("A2:D" & DerLig)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
' Récupérer la dernière ligne contenant des dates
DerLig = .Range("A" & Rows.Count).End(xlUp).Row
' Couper et coller les lignes dans la feuille Archives
.Rows("3:" & DerLig).Cut Destination:=Sheets("Archives").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
' Supprimer les lignes vide de la feuille Notes
.Rows("3:" & DerLig).Delete
' Récupérer la dernière ligne contenant des dates dans la colonne C
DerLig = .Range("C" & Rows.Count).End(xlUp).Row
' Faire le tri par date de la colonne C
.Sort.SortFields.Clear
.Sort.SortFields.Add Key:=Range("C3"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With .Sort
.SetRange Range("A2:D" & DerLig)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
End Sub