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
|
Private Sub recherche_cartes_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim rg As Range, sSaisie As String
If KeyCode <> 13 Then
Exit Sub
End If
sSaisie = recherche_cartes.Text
If sSaisie Like "##" Or sSaisie Like "##-##" Then
recherche_cartes.Text = sSaisie & "-"
Exit Sub
End If
If Len(recherche_cartes.Text) < 9 Then Exit Sub
Set rg = Range("A7:A500").Find(sSaisie, LookIn:=xlValues, LookAt:=xlWhole)
If Not rg Is Nothing Then
MsgBox ("Trouvé !")
Else
MsgBox ("pas trouvé !")
recherche_cartes.Text = ""
End If
End Sub |
Partager