Dim T() As Variant
Sub VentilNombre()
Dim n&, r&, c&, i&, x&, f&, s&
f = ActiveWorkbook.Worksheets.Count
c = 10 'Colonne J
n = Cells(65536, c).End(3).Row 'Dernière cellule active de la colonne choisie
For s = 1 To f 'Pour chaque feuille
Sheets(s).Activate
ReDim T(25, 2) 'Tableau virtuel pour comptage et ventilation
For i = 0 To 25
T(i, 0) = i * 20
T(i, 1) = T(i, 0) + 19
Next i
'Ventilation des nombres
For i = 2 To n
x = Int(Cells(i, c) / 20)
Select Case x
Case Is < 1: T(x, 2) = T(x, 2) + 1
Case Is < 2: T(x, 2) = T(x, 2) + 1
Case Is < 3: T(x, 2) = T(x, 2) + 1
Case Is < 4: T(x, 2) = T(x, 2) + 1
Case Is < 5: T(x, 2) = T(x, 2) + 1
Case Is < 6: T(x, 2) = T(x, 2) + 1
Case Is < 7: T(x, 2) = T(x, 2) + 1
Case Is < 8: T(x, 2) = T(x, 2) + 1
Case Is < 9: T(x, 2) = T(x, 2) + 1
Case Is < 10: T(x, 2) = T(x, 2) + 1
Case Is < 11: T(x, 2) = T(x, 2) + 1
Case Is < 12: T(x, 2) = T(x, 2) + 1
Case Is < 13: T(x, 2) = T(x, 2) + 1
Case Is < 14: T(x, 2) = T(x, 2) + 1
Case Is < 15: T(x, 2) = T(x, 2) + 1
Case Is < 16: T(x, 2) = T(x, 2) + 1
Case Is < 17: T(x, 2) = T(x, 2) + 1
Case Is < 18: T(x, 2) = T(x, 2) + 1
Case Is < 19: T(x, 2) = T(x, 2) + 1
Case Is < 20: T(x, 2) = T(x, 2) + 1
Case Is < 21: T(x, 2) = T(x, 2) + 1
Case Is < 22: T(x, 2) = T(x, 2) + 1
Case Is < 23: T(x, 2) = T(x, 2) + 1
Case Is < 24: T(x, 2) = T(x, 2) + 1
Case Is < 25: T(x, 2) = T(x, 2) + 1
Case Else: T(25, 2) = T(25, 2) + 1
End Select
Next i
'Ecriture des résultats dans un tableau
Cells(1, 3) = Ventilation
Cells(2, 3) = "De"
Cells(2, 4) = "A"
Cells(2, 5) = "Nombre"
For i = 0 To 24
Cells(i + 3, 3) = T(i, 0)
Cells(i + 3, 4) = T(i, 1)
Cells(i + 3, 5) = T(i, 2)
Next i
Cells(28, 3) = T(25, 0)
Cells(28, 4) = "et +"
Cells(28, 5) = T(25, 2)
Next s
End Sub