Public compte
Public run As Boolean
Sub decompte()
compte = 61
If run Then
run = False
End
End If
run = True
Call chrono
End Sub
Sub chrono()
Static test As String
Dim cel, c As Range
Set cel = Feuil1.[F9]
Set c = Feuil1.[L1] 'Numéro à trouver
test = IIf(cel > c, "C'est moins !", "C'est plus !")
If cel <> "" Then Feuil1.[E3] = test
If cel.Value = c.Value Then
[E3].Value = "C'est gagné !"
t = Timer + 2: Do Until Timer > t: DoEvents: Loop
[E3].Value = "Le juste prix de la vitrine est bien"
t = Timer + 2: Do Until Timer > t: DoEvents: Loop
[E3].Value = c.Value
[E3].NumberFormat = "0 €"
Call aleatoire
End
End If
If compte = 0 Then
[E3].Value = "Désolé, vous avez perdu."
t = Timer + 2: Do Until Timer > t: DoEvents: Loop
[E3].Value = "Le juste prix de la vitrine est de"
t = Timer + 2: Do Until Timer > t: DoEvents: Loop
[E3].Value = c.Value
[E3].NumberFormat = "0 €"
run = False
Sheets(1).Shapes("img").TextFrame.Characters.Text = 0
Exit Sub
Call aleatoire
End If
Application.OnTime Now + TimeValue("00:00:01"), procedure:="chrono", schedule:=run
compte = compte - 1
Sheets(1).Shapes("img").TextFrame.Characters.Text = compte
ActiveWorkbook.RefreshAll
End Sub
Sub aleatoire()
'Inscription d'un nombre aléatoire entre 10000 et 30000
Set Dico = CreateObject("Scripting.dictionary")
Randomize
While Dico.Count < 1
x = Int((20000 * Rnd()) + 10000)
Dico(x) = x
Wend
[L1].Resize(, 1) = Dico.keys
End Sub
Sub CRebours()
Dim i As Long
For i = 5 To 0 Step -1
Sheets(1).Shapes("bulle").TextFrame.Characters.Text = i
t = Timer + 1: Do Until Timer > t: DoEvents: Loop
Next i
Call decompte
End Sub