Bonjour
Essayez ceci, cliquez simplement sur la cellule S2
Le code dans le module de la feuille "MISE EN PLACE NUMEROS"
Private Sub Worksheet_SelectionChange1(ByVal Target As Range)
Dim Alea_Max As Long, Alea_Min As Long, Nb_Asterisque As Long, Num_Lettre As Long
Dim Lettre As String, Mot As String, Mot_Cache As String
On Error GoTo Sortie
If Not Intersect(Target, Range("S2")) Is Nothing Then
Application.EnableEvents = False
Randomize
Alea_Max = Application.Max(Range("C13:C" & Range("C" & Rows.Count).End(xlUp).Row)) + 12
Alea_Min = 13
Valeur = Int((Alea_Max - Alea_Min + 1) * Rnd) + Alea_Min
Target = Valeur
Mot = Cells(Valeur, "D")
Range("I10").Select
Range("I10").Value = Application.Rept("*", Len(Mot))
Nb_Asterisque = UBound(Split(Range("I10"), "*", , 1))
Mot_Cache = Application.Rept("*", Nb_Asterisque)
Do While Nb_Asterisque <> 0
Num_Lettre = Int((Len(Mot) - 1 + 1) * Rnd) + 1
Lettre = Mid(Mot, Num_Lettre, 1)
If Mid(Mot_Cache, Num_Lettre, 1) <> Lettre Then
Mid(Mot_Cache, Num_Lettre, 1) = Lettre
Tempo3
End If
Range("I10").Value = Mot_Cache
Nb_Asterisque = UBound(Split(Range("I10"), "*", , 1))
Loop
End If
Sortie:
Range("I10").Select
Application.EnableEvents = True
End Sub
Sub Tempo3()
For i = 1 To 50000000
Next i
End Sub
Cdlt