Dim encours As Boolean 'neutralise le bouton FLASH
Sub Bouton_FLASCH()
If encours Then Exit Sub
Dim p#, d As Object, choix%, t, n%, x As Boolean, c As Range
p = Val(Replace([X3], ",", ".")) 'période du clignotement
If p <= 0 Then Exit Sub
encours = True
[C26:C30,D32:D33] = "" 'RAZ
[B26:B30].Name = "Plage1"
[C32:C33].Name = "Plage2"
Set d = CreateObject("Scripting.Dictionary")
Randomize
For choix = 1 To 5 '5 valeurs
t = Timer
For n = 1 To 5 '5 clignotements
While Timer < t + p * n
x = Timer > t + p * (n - 0.5)
If x <> [flash] Then
1 For Each c In [A26:A75,B32:B42]
c = Rnd
Next c
d.RemoveAll
For Each c In [B26:C30] 'recherche des doublons
If c <> "" Then If d.exists(c.Value) Then GoTo 1
d(c.Value) = ""
Next c
If choix < 3 Then
d.RemoveAll
For Each c In [C32:D33] 'recherche des doublons
If c <> "" Then If d.exists(c.Value) Then GoTo 1
d(c.Value) = ""
Next c
End If
ThisWorkbook.Names.Add "flash", x, Visible:=False
End If
DoEvents
Wend
Next n
'---fixation des valeurs---
[C25].Offset(choix) = [B26]
If choix < 3 Then [D31].Offset(choix) = [C32]
'---redéfinition des plages---
If choix < 5 Then [B26].Resize(5 - choix).Name = "Plage1"
IIf(choix = 1, [C32], [D32:D33]).Name = "Plage2"
Next choix
[C26:C30].Name = "Plage1"
encours = False
End Sub
Sub Bouton_RAZ()
ThisWorkbook.Names.Add "flash", False, Visible:=False
[C26:C30,D32:D33] = ""
End
End Sub