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
| Option Explicit
Sub Dans15jours()
With ActiveWorkbook.Worksheets("Plan 2022").ListObjects("Tableau1")
'--- filtre entre jour +14 et +16 --- à adapter --- quid date est samedi ou dimanche ?
.Range.AutoFilter Field:=4, _
Criteria1:=">=" & Format(Date + 14, "yyyy-mm-dd"), _
Operator:=xlAnd, _
Criteria2:="<" & Format(Date + 17, "yyyy-mm-dd")
'--- trie par date
With .Sort
.SortFields.Add2 Key:=Range("Tableau1[Colonne D]"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
'--- parcourir les lignes filtrées triées
Dim rw As Range
For Each rw In Range("Tableau1").Columns(1).SpecialCells(xlCellTypeVisible)
'--- exemple de reprise des données de la ligne --- données à utiliser pour composition email (nombreux tutos sur ce sujet)
Debug.Print rw, rw.Offset(0, 1), rw.Offset(0, 2), rw.Offset(0, 3), rw.Offset(0, 4)
Next rw
End Sub |
Partager