Ajout de données par userform dans une feuille excel
Bonjour,
Je fais actuellement une base de données avec une interface (userform) en vba.
Jusque là tous va bien! Quand je rentre les données concernant des personnes dans l'userfom je veux envoyer les données sur une feuille excel.
Donc j'aimerais savoir comment faire pour envoyer les données sur une ligne vierge?
voici ce que j'ai fait mais ceci permet de cibler une ligne:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Private Sub CommandButton2_Click()
Sheets("BDD").Range("B2823").Value = TextBox1.Value 'nom
Sheets("BDD").Range("B2823").Value = TextBox2.Value 'prenom
Sheets("BDD").Range("B2823").Value = CheckBox1.Value 'genre homme
Sheets("BDD").Range("B2823").Value = CheckBox2.Value 'genre femme
Sheets("BDD").Range("B2823").Value = TextBox3.Value 'fonction
Sheets("BDD").Range("B2823").Value = TextBox4.Value 'adresse
Sheets("BDD").Range("B2823").Value = TextBox5.Value 'code postal
Sheets("BDD").Range("B2823").Value = TextBox6.Value 'ville
Sheets("BDD").Range("B2823").Value = TextBox7.Value 'telephone perso
Sheets("BDD").Range("B2823").Value = TextBox8.Value 'email perso
Sheets("BDD").Range("B2823").Value = TextBox9.Value 'nom structure
Sheets("BDD").Range("B2823").Value = TextBox10.Value 'type structure
Sheets("BDD").Range("B2823").Value = TextBox11.Value 'adresse pro
Sheets("BDD").Range("B2823").Value = TextBox12.Value 'code postal pro
Sheets("BDD").Range("B2823").Value = TextBox13.Value 'ville pro
Sheets("BDD").Range("B2823").Value = TextBox14.Value 'tel pro
Sheets("BDD").Range("B2823").Value = TextBox15.Value 'email pro
Sheets("BDD").Range("B2823").Value = CheckBox3.Value 'envois formation oui
Sheets("BDD").Range("B2823").Value = CheckBox4.Value 'envois formations non
Sheets("BDD").Range("B2823").Value = CheckBox5.Value 'dsi oui
Sheets("BDD").Range("B2823").Value = CheckBox6.Value 'dsi non
Sheets("BDD").Range("B2823").Value = TextBox16.Value 'dispositif
Sheets("BDD").Range("B2823").Value = TextBox17.Value 'statut
Sheets("BDD").Range("B2823").Value = CheckBox7.Value 'participations formations oui
Sheets("BDD").Range("B2823").Value = CheckBox8.Value 'participations formations non
Sheets("BDD").Range("B2823").Value = CheckBox9.Value 'usagers cdr oui
Sheets("BDD").Range("B2823").Value = CheckBox10.Value 'usagers cdr non
End Sub |
Si quelqu'un vois comment faire, je suis preneur....Merci et bonne journée