Sub CheckBox8_Click()
Coche CheckBox8
End Sub
Sub CheckBox9_Click()
Coche CheckBox9
End Sub
Sub CheckBox10_Click()
Coche CheckBox10
End Sub
Sub Coche(CB As Object)
Static flag As Boolean
If flag Then Exit Sub 'bloque l'exécution
Dim a, b, i As Byte, j As Byte, k As Byte, temp As Byte
a = Array("CheckBox8", "CheckBox9", "CheckBox10")
b = Array("Avant", "Arrière", "Avant/Arrière")
i = Application.Match(CB.Name, a, 0)
j = IIf(i = 3, 1, i + 1)
k = IIf(j = 3, 1, j + 1)
Randomize
If Rnd > 0.5 Then temp = j: j = k: k = temp 'permutation aléatoire
flag = True
Me.OLEObjects(Application.Index(a, j)).Object = Not CB
Me.OLEObjects(Application.Index(a, k)).Object = 0
flag = False
[E60] = Application.Index(b, IIf(CB, i, j))
End Sub