Bon, j'avance a mon rythme toujours sur la meme base....
Voici mon code :
Sub test()
Dim DrLig As Long, Lig As Long
For Each shift In Array("Jour", "Nuit")
For Each code In Array("93", "98", "99") =========> pb ici !!!
Total = 0
DrLig = Sheets(1).Columns(1).Find("*", , , , xlByColumns, xlPrevious).Row
ActiveSheet.Range("$A$1:$F$" & DrLig).AutoFilter Field:=3, Criteria1:=shift
ActiveSheet.Range("$A$1:$F$" & DrLig).AutoFilter Field:=5, Criteria1:=code
For Lig = 2 To DrLig
If Rows(Lig).Hidden = False Then
ma = Cells(Lig, 1)
da = Cells(Lig, 2)
Sh = Cells(Lig, 3)
co = Cells(Lig, 5)
Total = Cells(Lig, 6) + Total
Rows(Lig).ClearContents
End If
Next
Cells(Lig, 1) = ma
Cells(Lig, 2) = da
Cells(Lig, 3) = Sh
Cells(Lig, 4) = ""
Cells(Lig, 5) = co
Cells(Lig, 6) = Total
Cells(Lig, 6).NumberFormat = "0.00"
Next
Next
Columns("A:F").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets(1).Sort.SortFields.Clear
ActiveWorkbook.Worksheets(1).Sort.SortFields.Add Key:=Range("B2:B" & DrLig + 1) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets(1).Sort
.SetRange Range("A1:F" & DrLig + 1)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
With Worksheets(1)
If .FilterMode = True Then .ShowAllData
End With
End Sub
Le seul point bloquant c'est que je ne trouve pas comment faire pour recuperer la liste des criteres du filtre automatique de ma cellule Code (d'ou le tableau Array avec les differents codes a filtrer 93,98,99....). Si quelqu'un sait comment faire ca me serait vraiment utile....
Merci