Lone-Gan
03-23-2010, 01:13 AM
Bonjour,
J'ai créé deux formulaires; le principal (formulaire 1) avec une listbox et 4 textbox, et un autre me servant pour rentrer les données.
Pour l' instant je n'ai réussi qu'à faire ceci:
Formulaire 1
Private Sub UserForm_Initialize()
Worksheets("Data").Visible = False
Worksheets("Data").Activate
Nom.Value = Range("A2").Value
Prénom.Value = Range("B2").Value
Téléphone.Value = Range("F2").Value
Natel.Value = Range("G2").Value
End Sub
Private Sub Ouvre_Click()
Load UserForm2
UserForm2.Show
End Sub
Private Sub Ferme_Click()
Unload UserForm1
End Sub
Le code n'est pas vraiment professionnel (je débute en VBA);
ce que j'aimerai, c'est d'afficher les noms et prénoms (en colonnes)
dans la listbox et ensuite sur double-clic, afficher les champs correspondants dans les textbox.
Pourriez-vous me montrer le code complet? Merci beaucoup.
Traduction
Hello,
I created two forms, the principal (Form 1) with a listbox and 4 textbox, and another I used to return data.
For the moment I managed to do this:
Form 1
Private Sub UserForm_Initialize ()
Worksheets ( "Data"). Visible = False
Worksheets ( "Data"). Activate
Nom.Value = Range ( "A2"). Value
Prénom.Value = Range ( "B2"). Value
Téléphone.Value = Range ( "F2"). Value
Natel.Value = Range ( "G2"). Value
End Sub
Private Sub Ouvre_Click ()
Load UserForm2
UserForm2.Show
End Sub
Private Sub Ferme_Click ()
Unload UserForm1
End Sub
The code is not really professional (I started in VBA);
what I like is to display the names and surnames (in columns)
in the listbox and then double-click and view the corresponding fields
in the textbox.
Could you show me the complete code?
Thank you very much.
J'ai créé deux formulaires; le principal (formulaire 1) avec une listbox et 4 textbox, et un autre me servant pour rentrer les données.
Pour l' instant je n'ai réussi qu'à faire ceci:
Formulaire 1
Private Sub UserForm_Initialize()
Worksheets("Data").Visible = False
Worksheets("Data").Activate
Nom.Value = Range("A2").Value
Prénom.Value = Range("B2").Value
Téléphone.Value = Range("F2").Value
Natel.Value = Range("G2").Value
End Sub
Private Sub Ouvre_Click()
Load UserForm2
UserForm2.Show
End Sub
Private Sub Ferme_Click()
Unload UserForm1
End Sub
Le code n'est pas vraiment professionnel (je débute en VBA);
ce que j'aimerai, c'est d'afficher les noms et prénoms (en colonnes)
dans la listbox et ensuite sur double-clic, afficher les champs correspondants dans les textbox.
Pourriez-vous me montrer le code complet? Merci beaucoup.
Traduction
Hello,
I created two forms, the principal (Form 1) with a listbox and 4 textbox, and another I used to return data.
For the moment I managed to do this:
Form 1
Private Sub UserForm_Initialize ()
Worksheets ( "Data"). Visible = False
Worksheets ( "Data"). Activate
Nom.Value = Range ( "A2"). Value
Prénom.Value = Range ( "B2"). Value
Téléphone.Value = Range ( "F2"). Value
Natel.Value = Range ( "G2"). Value
End Sub
Private Sub Ouvre_Click ()
Load UserForm2
UserForm2.Show
End Sub
Private Sub Ferme_Click ()
Unload UserForm1
End Sub
The code is not really professional (I started in VBA);
what I like is to display the names and surnames (in columns)
in the listbox and then double-click and view the corresponding fields
in the textbox.
Could you show me the complete code?
Thank you very much.