BONJOUR,
je suis sur excel et j'utilise plusieurs combobox nommées cbox( 35 pour les chiffrées) liées entre elles par le code suivant


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
cbox1.Text = cbox1.List(cbox1.ListIndex)
cbox2.Text = cbox2.List(cbox1.ListIndex)
cbox3.Text = cbox3.List(cbox1.ListIndex)
cbox4.Text = cbox4.List(cbox1.ListIndex)
cbox5.Text = cbox5.List(cbox1.ListIndex)
cbox6.Text = cbox6.List(cbox1.ListIndex)
cbox7.Text = cbox7.List(cbox1.ListIndex)
cbox8.Text = cbox8.List(cbox1.ListIndex)
cbox9.Text = cbox9.List(cbox1.ListIndex)
cbox10.Text = cbox10.List(cbox1.ListIndex)
cbox11.Text = cbox11.List(cbox1.ListIndex)
cbox12.Text = cbox12.List(cbox1.ListIndex)
cbox13.Text = cbox13.List(cbox1.ListIndex)
cbox14.Text = cbox14.List(cbox1.ListIndex)
cbox15.Text = cbox15.List(cbox1.ListIndex)
cbox16.Text = cbox16.List(cbox1.ListIndex)
cbox17.Text = cbox17.List(cbox1.ListIndex)
cbox18.Text = cbox18.List(cbox1.ListIndex)
cbox19.Text = cbox19.List(cbox1.ListIndex)
cbox20.Text = cbox20.List(cbox1.ListIndex)
etc......
et ceci pour les 35 private sub cbox35_click()



je souhaiterai faire une sorte de boucle avec un variable j
de telle sorte que
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
dim namebox as string
For j= 1 to 35

Private Sub namebox_click()
cbox1.Text = cbox1.List(namebox.ListIndex)
cbox2.Text = cbox2.List(namebox.ListIndex)
cbox3.Text = cbox3.List(namebox.ListIndex)
cbox4.Text = cbox4.List(namebox.ListIndex)
cbox5.Text = cbox5.List(namebox.ListIndex)
cbox6.Text = cbox6.List(namebox.ListIndex)
cbox7.Text = cbox7.List(namebox.ListIndex)
cbox8.Text = cbox8.List(namebox.ListIndex)
cbox9.Text = cbox9.List(namebox.ListIndex)
cbox10.Text = cbox10.List(namebox.ListIndex)
de telle maniere à eviter 35 lignes pour les 35 cbox soit au moins 1225 lignes de saisies