1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
'Validation par la touche entrée de la Textbox2
If KeyCode = 13 Then
'Recherche de la ville
Dim Cell As Range
Set Cell = Range("A13:A38962").Find(Me.TextBox2, LookIn:=xlFormulas, Lookat:=xlWhole)
If Me.TextBox2 = "" Then Exit Sub
If Not Cell Is Nothing Then
MsgBox ("Ville Trouvée à la Ligne " & Cell.Row & ".")
'Positionnement du curseur sur la cellule
Cell.Offset(0, 0).Select
TextBox2.Text = ""
Else
'Si ville non trouvée
MsgBox ("Ville Non Trouvée.")
TextBox2.Text = ""
End If
End If
End Sub |
Partager