'Tri par date de facturation ou proposition
If Range("B" & Rows.Count).End(xlUp).Row >= Range("C" & Rows.Count).End(xlUp).Row Then
Ligne = Range("B" & Rows.Count).End(xlUp).Row
Else:
Ligne = Range("E" & Rows.Count).End(xlUp).Row
End If
For i = 2 To Ligne
If Cells(i, 2) <> "" Then
Cells(i, 12) = Cells(i, 2)
ElseIf Cells(i, 5) <> "" Then
Cells(i, 12) = Cells(i, 5)
End If
Next i
ActiveWorkbook.Worksheets(produit).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(produit).Sort.SortFields.Add Key:=Range("L2:L" & Ligne), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(produit).Sort
.SetRange Range("A2:L" & Ligne)
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("A:L" ).Select
Selection.AutoFilter
|