bonjour le forum,
Voici un code qui me permet de faire un tirage aléatoire de poules qui l'envoie sur la Feuile Série de mon fichier en B7:R13 et ma question est : set-il possible de faire en même temps un autre tirage aléatoire à partir de cette macro qui se place par contre en B17:R23.
merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 Sub testSMF1() Dim deja(200) As Boolean Dim tablo(200) Randomize 'utilise l'heure system pour Rnd nb = Feuil4.[A6].End(xlDown).Row - 6 'nombre joueurs For k = 1 To nb 'création tablo de 1 à nb aléatoire Do n = Int((nb * Rnd) + 1) If deja(n) = False Then deja(n) = True tablo(k) = n Exit Do End If Loop Next Sheets("Série").Range("B7:R13").ClearContents If Range("Q5") <> "" Then nombredepoules = Range("Q5") Else MsgBox ("Donnez le nombre de poules") Exit Sub End If ligne = 7 col = 2 pas = 3 For n = 7 To Range("A65536").End(xlUp).Row Sheets("Série").Cells(ligne, col) = Range("A" & tablo(n - 6) + 6) col = col + pas If col = 2 + 3 * nombredepoules Or col = -1 Then ligne = ligne + 1 col = col - pas pas = -pas End If Next n Sheets("Série").Select Application.Calculation = xlCalculationAutomatic End SubVoici ma question
jacky
Partager