Private Function NomPrenomExistent() As Boolean
If Trim(TextBox2) <> "" And Trim(TextBox3) <> "" Then
Dim p As Variant
With Sheets("BD")
p = Application.VLookup(TextBox2, .Range("B7:C" & .Range("A65536").End(xlUp).Row), 2, False)
If Not IsError(p) Then NomPrenomExistent = UCase(p) = UCase(TextBox3)
End With
End If
End Function
Private Sub TextBox2_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Cancel = NomPrenomExistent()
If Cancel Then MsgBox Application.Proper(TextBox2 & " " & TextBox3) & " existe déjà dans la base de données"
End Sub
Private Sub TextBox3_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Cancel = NomPrenomExistent()
If Cancel Then MsgBox Application.Proper(TextBox2 & " " & TextBox3) & " existe déjà dans la base de données"
End Sub