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
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
Partager