Re : Sélection proportionnelle et automatique de lignes pour enquête de satisfaction
Re,
Après quelques tests, cela semble convenir. J'essaierai sur la base réelle cette semaine.
Afin que je comprenne bien et que je m'"enrichisse", peux-tu m'expliquer ces trois macros :
Sub tirage()
'Stop
'nb = Int((derligne * Rnd) + 1)
For j = premligne To derligne
Cells(j, 10) = Int((nb * Rnd) + 1)
Next j
End Sub
Sub classement()
derligne = Sheets("Feuil1").Range("A65530").End(xlUp).Row
Range("A2:J" & derligne).Select
Selection.Sort Key1:=Range("I2"), Order1:=xlAscending, Key2:=Range("J2"), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:= _
xlSortNormal
premligne = 2
a = Cells(2, 9)
For i = 2 To 46
If Cells(i + 1, 9) <> a Then
derligne = i
Call choix
premligne = derligne + 1
a = Cells(derligne + 1, 9)
End If
Next i
End Sub
Sub choix()
'Stop
nombre = Round((derligne - premligne + 1) / 3, 0)
For j = premligne To derligne
If j >= nombre + premligne Then j = derligne: GoTo suite
Cells(j, 8) = "A générer"
suite:
Next j
End Sub
Merci encore pour le partage de connaissances!