Option Explicit
Dim ws As Worksheet
Private Sub UserForm_Initialize()
ComboBox2.List() = Array("Mr", "Mme")
Set ws = Sheets("Controle") 'Attention ce nom doit correspondre au non de l'onglet dans le fichier
ws.Activate
End Sub
Private Sub Telephone_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.Telephone.Value = Format(Me.Telephone.Value, "00 00 00 00 00 ")
End Sub
Private Sub Valider_Click() 'bouton valider
If MsgBox("Etes-vous certain de vouloir Insérer ce nouveau numéro?", vbYesNo, "Demande de confirmation") = vbYes Then
With ws.ListObjects("Tableau1").ListRows.Add:
.Range.Resize(, 3) = Array(Telephone, ComboBox2, Nom_Prenom): .Range(1).Select
End With
MsgBox ("Numéro Insérer dans le Fichier") 'Informe que le présent contact est insérer dans le tableau
End If
End Sub
Private Sub Quitter_Click()
Unload Me 'Ferme le Formulaire
Accueil.Show 0 'ouvre le Formulaire Accueil
End Sub