Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Cancel = TextBox1 = ""
If TextBox1 = "" Then Exit Sub
If [Tableau1[VILLES]].Find(TextBox1, LookAt:=1) Is Nothing Then Exit Sub
MsgBox " ville déjà présente !", 16, "Saisie invalidée ..."
TextBox1 = "": Cancel = 1
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsNumeric(TextBox2) Then TextBox2 = ""
Cancel = Not IsNumeric(TextBox2)
End Sub
Private Sub CommandButton1_Click()
Dim C As Range, L as long
With [Tableau1]
L = IIf(.Item(1, 1) = "", 1, .Rows.Count + 1): Set C = .Item(L, 1)
End With
C(1, 1) = TextBox1: C(1, 2) = CDbl(TextBox2)
Unload Me
End Sub