voila je voulais pour amuser mon petit fils simuler un tirage du loto et un message loop sans do apparait alors que je n'ai pas de if dans la séquence.. merci à vous


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
38
39
40
41
42
43
44
Dim Bobo As Variant
Dim Compt As Variant
Dim Myvalue As Integer
Dim Colo As Integer
 
Bobo = 1
Range("a1").Select
ActiveCell.FormulaR1C1 = Bobo
Do Until Bobo = 50
Selection.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = Bobo + 1
Bobo = Bobo + 1
Loop
 
Colo = 6
 
Compt = 1
Do While Compt <> 7
Myvalue = 49 * (Rnd * 1) + 1
Cells(Myvalue, 1).Select
Selection.Cut
Cells(3, Colo).Select
ActiveSheet.Paste
MsgBox ("Tirage du numero" & vbNewLine & "Cliquer sur Ok pour tirage du nouveau numero")
Columns("a:a").Select
        ActiveWorkbook.Worksheets("Feuil2").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("Feuil2").Sort.SortFields.Add2 Key:=Range("A1:A49") _
        , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Feuil2").Sort
        .SetRange Range("A1:A49")
        .Header = xlNo
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
 
Colo = col + 1
Compt = Compt + 1
Loop
 
 
 
 
End Sub