XL 2016 Insérer le contenu d'un userform dans un tableau

MAQUIN

XLDnaute Nouveau
bonjour à tous, je souhaite réaliser un masque de saisie pour un fichier client, mais je suis autodidacte en VBA.
j'ai créé un userform mais la commande valider ne fonctionne et je ne comprends vraiment pas pourquoi.
y aurait il un bon samaritain pour un petit coup de main ?
fichier ci dessous
merci d'avance
 

Pièces jointes

  • Essai v1.9 fichier client.xlsm
    28.2 KB · Affichages: 36

vgendron

XLDnaute Barbatruc
Hello

corriger le code comme suit
VB:
Private Sub CommandButton_Valider_Click()

    Dim no_ligne As Integer, civilite As String
    
    For Each bouton_civilités In Frame_Civilités.Controls
        If bouton_civilités.Value Then
            Civilités = bouton_civilités.Caption
        End If
    Next
      
     With Sheets("Fichier Client")
        no_ligne = .Range("A" & .Rows.Count).End(xlUp).Row + 1
        .Cells(no_ligne, 1) = Me.ComboBox_Groupe1.Value
        .Cells(no_ligne, 2) = ComboBox_Groupe2.Value
        .Cells(no_ligne, 3) = civilite
        .Cells(no_ligne, 4) = TextBox_Prénom.Value
        .Cells(no_ligne, 5) = TextBox_Nom.Value
        .Cells(no_ligne, 6) = ComboBox_Note.Value
        .Cells(no_ligne, 7) = TextBox_Entreprise.Value
        .Cells(no_ligne, 8) = TextBox_Fonction.Value
        .Cells(no_ligne, 9) = TextBox_Portable.Value
        .Cells(no_ligne, 10) = TextBox_Fixe.Value
        .Cells(no_ligne, 11) = TextBox_Email.Value
        .Cells(no_ligne, 12) = TextBox_Adresse.Value
        .Cells(no_ligne, 13) = TextBox_Codepostal.Value
        .Cells(no_ligne, 14) = TextBox_Ville.Value
    End With
  
    ComboBox_Groupe1.ListIndex = -1
    ComboBox_Groupe2.Value = -1
    TextBox_Prénom.Value = ""
    TextBox_Nom.Value = ""
    ComboBox_Note = -1
    TextBox_Entreprise.Value = ""
    TextBox_Fonction.Value = ""
    TextBox_Portable.Value = ""
    TextBox_Fixe.Value = ""
    TextBox_Email.Value = ""
    TextBox_Adresse.Value = ""
    TextBox_Codepostal.Value = ""
    TextBox_Ville.Value = ""
      
  
End Sub

et renommer le comboboxGROupe1: manque le R
 

vgendron

XLDnaute Barbatruc
Helle Pierre jean

Re
et j'ai oublié: les Text box de numéro de tel sont nommés TextBox_Portable TextBox_Fixe
pas de TEL dans le nom

et pour l'espace entre Fichier et Client.. j'ai oublié de le remettre parce que j'avais modifié le nom de l'onglet.. pour test

et enfin. le Me dans .Cells(no_ligne, 1) = Me.ComboBox_Groupe1.Value
est inutile puisqu'un seul USF
 

Discussions similaires

Statistiques des forums

Discussions
312 520
Messages
2 089 286
Membres
104 086
dernier inscrit
lucasjol