Rowsource

errog

XLDnaute Junior
Bonsoir,
Je voudrais réécrire le code suivant ..
PHP:
USF_LIBELLE.ListBox1.RowSource = "A1:A10"
USF_LIBELLE.ListBox2.RowSource = "B1:B10"
USF_LIBELLE.ListBox3.RowSource = "C1:C10"
...........
avec une boucle

PHP:
For i = 1 to 10
USF_LIBELLE.Controls("ListBox" & i).RowSource =  Range(Cells(1, i), Cells(10, i))
Next i

mais je n'y arrive pas :confused::confused:

Merci
 
C

Compte Supprimé 979

Guest
Re : Rowsource

Salut Errog,

La formule magique est :
Code:
For i = 1 to 10 
USF_LIBELLE[COLOR=darkgreen][B]("ListBox" & i[/B][/COLOR]).RowSource =  Range(Cells(1, i), Cells(10, i))[COLOR=darkgreen][B].Address[/B][/COLOR]
Next i

Voilà ;)
 
Dernière modification par un modérateur:

Spitnolan08

XLDnaute Barbatruc
Re : Rowsource

Bonsoir,

Un petit tour par la FAQ ...
Code:
Private Sub UserForm_initialize()
For i = 1 To 10
With Sheets("tafeuille")
USF_Libelle.Controls("ListBox" & i).List = .Range(Cells(1, i), Cells(10, i)).Value
End With
Next i
End Sub
La propriété rowsource est à bannir des USF

Cordialement

Edit : Salut BrunoM45
 
Dernière édition:

Discussions similaires