Choix listbox vers combobox multiple
Bonjour,
J'ai besoin d'un petit coup de main.
Depuis un Userform1[UsfLignes] je lance une Userform2 pour faire un choix à retourner dans une Userform.combobox1
C'est pu écrire le code pour le 1er combobox1.
Code:
1 2 3 4 5 6
|
' Appel Userform liste
Private Sub ImgCombobox1_Click()
frm_Liste.Show
End Sub |
Code:
1 2 3 4 5
|
Private Sub ListBox1_Click()
UsfLignes.CboCompte1 = Val(ListBox1.List(ListBox1.ListIndex, 0))
Unload Me
End Sub |
Ce code fonctionne pour la première ligne, mais j'ai 12 Combobox
J'ai écrit ce code mais il ne fonctionne pas
Dans mon Userform1 [UsfLignes]
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
Public Lign As Integer
Private Sub ImgCompte1_Click()
Lign = 1
frm_PlanComptable.Show
End Sub
.Private Sub ImgCompte2_Click()
Lign = 2
frm_PlanComptable.Show
End Sub
.
Etc |
Dans mon Userform2
Code:
1 2 3 4 5 6 7 8 9 10 11
|
Private Sub ListBox1_Click()
Dim n As Integer
'UsfLignes.CboCompte1 = Val(ListBox1.List(ListBox1.ListIndex, 0))
n = UsfLignes.Lign
Me.Controls("UsfLignes.CboCompte" & n).Value = Val(ListBox1.List(ListBox1.ListIndex, 0))
Unload Me
End Sub |
J'ai bien dans n le no de la ligne provenant de l'Userform1 et Tt ma valeur.
Mais le résultat ne s'affiche pas dans la combobox(x) de l'Userform1
correspondante à la ligne d'appel.
Merci d'avance de votre aide, pour aboutir