Option Explicit
Option Compare Text
Dim t As Variant, ta() As String, p As Long, s As Long
Dim X As Long, i As Long, j As Long, k As Long, e As Byte
Const entrees_entieres_permises = "0123456789"
' Modifier propriété MaxLength TextBox3 : 14
Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox3.Text = Format(TextBox3.Text, "0# ## ## ## ##")
End Sub
Private Sub TextBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If InStr(entrees_entieres_permises, Chr(KeyAscii)) = 0 Then KeyAscii = 0
End Sub
Private Sub TextBox3_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
End Sub
If Len(TextBox3.Text) = 10 Then TextBox3.Text = Format(TextBox3.Text, "0# ## ## ## ##")
Private Sub CommandButton4_Click()
Unload Me: [a1].Select
End Sub
Private Sub CommandButton5_Click()
t = Range("a8:f" & Range("a65536").End(xlUp).Row)
Lbx1.List = t
End Sub
Private Sub Image1_Click()
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label2_Click()
End Sub
Private Sub reset_Click()
Unload Me: UserForm1.Show
End Sub
Private Sub Tbx1_Change()
On Error Resume Next
Application.ScreenUpdating = False
t = Range("a8:f" & Range("a65536").End(xlUp).Row)
Lbx1.Clear
X = 1
For i = 1 To UBound(t)
For j = 1 To 4
If Left(t(i, j), Len(Tbx1)) = Left(Tbx1, Len(Tbx1)) Then
ReDim Preserve ta(1 To 6, 1 To X)
For k = 1 To 6
ta(k, X) = t(i, k)
Next k: X = X + 1: End If: Next j: Next i
Lbx1.List = Application.Transpose(ta)
If X - 1 = 1 Then
For e = 1 To 6
Controls("Textbox" & e) = Lbx1.List(Lbx1.ListIndex + e)
Next e: Lbx1.Clear: End If
Erase t, ta
If Tbx1 = "" Then
Lbx1.Clear
For e = 1 To 6: Controls("Textbox" & e) = "": Next e: Lbx1.Clear: End If
Beep
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox2_Change()
End Sub
Private Sub TextBox3_Change()
End Sub
Private Sub TextBox4_Change()
End Sub
Private Sub TextBox7_Change()
End Sub
Private Sub TextBox8_Change()
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then Cancel = True
End Sub
Private Sub lbx1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Label1.Caption = ""
p = 0.02: s = Timer: Do While Timer < s + p: DoEvents: Loop
Label1.Caption = "1111"
End Sub