Option Explicit
Sub EtablirListe()
Dim LAt As New ListeAléat, TRés(), L As Long, C As Long, NAl As Long, P As Long, Combi As String
ReDim TRés(1 To 1000, 1 To 240)
Randomize
LAt.Init 9 ^ 6
Combi = "******"
For L = 1 To 1000: For C = 1 To 240
NAl = LAt.Aléat: LAt.Supprimer NAl: NAl = NAl - 1
For P = 6 To 1 Step -1: Mid$(Combi, P, 1) = NAl Mod 9 + 1: NAl = NAl \ 9: Next P
TRés(L, C) = Combi: Next C, L
ActiveSheet.[B2].Resize(1000, 240).Value = TRés
End Sub
Sub EtablirClassée()
Dim TRés(), LAt As New ListeAléat, TAl() As Long, L As Long, C As Long, _
N As Long, NAl As Long, Combi As String, P As Long
ReDim TRés(1 To 1000, 1 To 240)
Randomize
LAt.Init 9 ^ 6
LAt.ExtraireClassés TAl, 240000
Combi = "******"
For L = 1 To 1000: For C = 1 To 240
N = N + 1: NAl = TAl(N) - 1
For P = 6 To 1 Step -1: Mid$(Combi, P, 1) = NAl Mod 9 + 1: NAl = NAl \ 9: Next P
TRés(L, C) = Combi: Next C, L
ActiveSheet.[B2].Resize(1000, 240).Value = TRés
End Sub