Bonjour,
3 macros
repartition, correspond à ta première demande
tiralea, genere des nombres aléatoires pour remplir Q2 à S7
T10fois, lance 10 x le tirage aléatoire (mais tu as dû oublier de nous dire ce qu'il fallait faire avec ces tirages). comme tel cela n'a aucune utilité.
Option Base 1
Sub repartition()
Dim r As Variant, cr(7)
Dim ta()
ReDim ta(7, 10000)
dl = Range("A" & Rows.Count).End(xlUp).Row
r = Range("A2:E" & dl)
For i = 1 To dl - 1
For j = 1 To 5
ptr = Int(r(i, j) / 10) + 1
cr(ptr) = cr(ptr) + 1
If cr(ptr) > maxptr Then maxptr = cr(ptr)
ta(ptr, cr(ptr)) = r(i, j)
Next j
Next i
ReDim Preserve ta(7, maxptr)
Range("H2").Resize(maxptr, 7) = Application.Transpose(ta)
End Sub
Sub tiralea()
For i = 1 To 3
For j = 2 To 7
Cells(j, i + 16) = Application.RandBetween((i - 1) * 10, i * 10 - 1)
Next j
Next i
End Sub
Sub t10fois()
For i = 1 To 10
tiralea
Next i
End Sub