Private Sub Btn_Valider_Click()
Dim vTotal As String
Dim nom As String: Dim prenom As String
Dim la_ligne As Integer: Dim ident As Integer
vTotal = 5 - Val(T_Total.Value)
If vTotal = 1 Then
MsgBox "Veuillez vérifier votre saisie. " & Chr(10) & "il manque " & vTotal & " Donnée", vbOKOnly + vbInformation, "Produit Ajouté."
Exit Sub
End If
If vTotal > 1 Or T_Total.Value < 5 Then
MsgBox "Veuillez vérifier votre saisie. " & Chr(10) & "il manque " & vTotal & " Données", vbOKOnly + vbInformation, "Produit Ajouté."
Exit Sub
End If
nom = "" 'Range("B7").Value
prenom = "" 'Range("D7").Value
la_ligne = 3
Do While Sheets("Clients").Cells(la_ligne, 4).Value <> nom And Sheets("Clients").Cells(la_ligne, 5).Value <> prenom And Sheets("Clients").Cells(la_ligne, 2).Value <> ""
ident = Sheets("Clients").Cells(la_ligne, 2).Value
la_ligne = la_ligne + 1
Loop
Sheets("Clients").Cells(la_ligne, 2).Value = Txt_ID.Value ' Numéro de la fiche du film
Sheets("Clients").Cells(la_ligne, 3).Value = Cmb_Civilite.Value ' Civilité
Sheets("Clients").Cells(la_ligne, 4).Value = Txt_Nom.Value ' Nom du Client
Sheets("Clients").Cells(la_ligne, 5).Value = Txt_Prenom.Value ' Prénom du client
Sheets("Clients").Cells(la_ligne, 6).Value = Txt_CP.Value ' Code Postal
Sheets("Clients").Cells(la_ligne, 7).Value = Txt_Ville.Value ' Ville
Sheets("Clients").Cells(la_ligne, 8).Value = Txt_Adresse.Value ' Adresse"
' Sheets("Clients").Cells(la_ligne, 9).Value = Txt_Mail.Value ' Mail du client
ActiveSheet.Hyperlinks.Add _
Anchor:=ActiveSheet.Cells(la_ligne, 9), Address:="mailto:" & Txt_Mail.Text, TextToDisplay:=Txt_Mail.Text
Sheets("Clients").Cells(la_ligne, 11).Value = Format(Me.Txt_Tel.Value, "0# ## ## ## ##") ' tél du client
Sheets("Clients").Cells(la_ligne, 12).Value = Format(Me.Txt_Fax.Value, "0# ## ## ## ##") ' fax du client
MsgBox "Le client a été créé avec succès.", vbOKOnly + vbInformation, "Client Ajouté."
'Unload Me
End Sub