Sub Statistiques()
'
' Statistiques Macro
'
'
' Bilan1 Macro
'
ligne2 = 3
nbr = 0
nbpz1 = 0
nbpz2 = 0
nbpz3 = 0
nbpz12 = 0
nbpz123 = 0
nbpz23 = 0
nbpz13 = 0
With Worksheets("STATISTIQUE")
date1 = .Cells(14, 11).Value
date2 = .Cells(14, 20).Value
End With
With Worksheets("PERMISDATA")
nbr = .Range("A" & .Rows.Count).End(xlUp).Row
For ligne2 = 3 To nbr
PDebut = .Cells(ligne2, 7).Value
PFin = .Cells(ligne2, 8).Value
NPermis = .Cells(ligne2, 1).Value
Zone = .Cells(ligne2, 6).Value
If date1 >= PDebut And date2 <= PFin Then
Select Case UCase(Zone)
Case "Z1"
nbpz1 = nbpz1 + .Cells(ligne2, 9).Value
With Worksheets("STATIS_HEBDO")
.Cells(12, 4).Value = nbpz1
End With
Case "Z2"
nbpz2 = nbpz2 + .Cells(ligne2, 9).Value
With Worksheets("STATIS_HEBDO")
.Cells(11, 4).Value = nbpz2
End With
Case "Z3"
nbpz3 = nbpz3 + .Cells(ligne2, 9).Value
With Worksheets("STATIS_HEBDO")
.Cells(10, 4).Value = nbpz3
End With
Case "Z1-Z2"
nbpz1 = nbpz1 + .Cells(ligne2, 9).Value
nbpz2 = nbpz2 + .Cells(ligne2, 9).Value
With Worksheets("STATIS_HEBDO")
.Cells(12, 4).Value = nbpz1
.Cells(11, 4).Value = nbpz2
End With
Case "Z1-Z2-Z3"
nbpz1 = nbpz1 + .Cells(ligne2, 9).Value
nbpz2 = nbpz2 + .Cells(ligne2, 9).Value
nbpz3 = nbpz3 + .Cells(ligne2, 9).Value
With Worksheets("STATIS_HEBDO")
.Cells(12, 4).Value = nbpz1
.Cells(11, 4).Value = nbpz2
.Cells(10, 4).Value = nbpz3
End With
Case "Z2-Z3"
nbpz2 = nbpz2 + .Cells(ligne2, 9).Value
nbpz3 = nbpz3 + .Cells(ligne2, 9).Value
With Worksheets("STATIS_HEBDO")
.Cells(11, 4).Value = nbpz2
.Cells(10, 4).Value = nbpz3
End With
Case "Z1-Z3"
nbpz1 = nbpz1 + .Cells(ligne2, 9).Value
nbpz3 = nbpz3 + .Cells(ligne2, 9).Value
With Worksheets("STATIS_HEBDO")
.Cells(12, 4).Value = nbpz1
.Cells(10, 4).Value = nbpz3
End With
End Select
End If
Next ligne2
End With
MsgBox "Statistiques du " & date1 & " au " & date2 & bCrLf & " réalisées Avec Succès"
End Sub