Erreur 35600, Index out of Bounds, Remplir combobox à partir d'une listview
cs_Gekco
Messages postés20Date d'inscriptionmercredi 24 mars 2010StatutMembreDernière intervention17 mai 2010
-
29 avril 2010 à 11:09
cs_Gekco
Messages postés20Date d'inscriptionmercredi 24 mars 2010StatutMembreDernière intervention17 mai 2010
-
29 avril 2010 à 11:35
Bonjour,
J'aimerai remplir une combobox sans doublons à l'aide d'une colonne d'une listview (filtrée). J'ai ce code ci :
Private Sub ComboBox9_DropButtonClick()
'Variables locales
Dim i As Integer
Dim MonDico
Dim c As Range
Dim Plage
'Remplit la Combo
For i = 1 To 14
If ComboBox10.Value = Cells(1, i).Value Then
Set MonDico = CreateObject("Scripting.Dictionary")
For Each c In Range(ListView1.ListItems(2).ListSubItems(i), ListView1.ListItems(65000).ListSubItems(i))
If Not MonDico.Exists(c.Value) Then MonDico.Add c.Value, c.Value
Next c
Me.ComboBox9.List = MonDico.items
End If
Next i
End Sub
et une erreur 35600 Index out of bounds.
Avec :
For Each c In Range(Cells(2,i),Cells(65000,i))
cela marche nickel mais il me prend toutes mes données et pas celles filtrées c'est pour cela que je pensais passer par les données que la listView affiche.
Merci pour votre aide.
T
A voir également:
Erreur 35600, Index out of Bounds, Remplir combobox à partir d'une listview
cs_Gekco
Messages postés20Date d'inscriptionmercredi 24 mars 2010StatutMembreDernière intervention17 mai 2010 29 avril 2010 à 11:35
J'ai testé :
'Remplit la Combo
For i = 1 To 14
If ComboBox10.Value = Cells(1, i).Value Then
Set MonDico2 = CreateObject("Scripting.Dictionary")
For j = 2 To 1000
For Each c In Range(Cells(2, i), Cells(65000, i))
If Not c.Value = ListView1.ListItems(j).ListSubItems(i).Text Then MonDico2.Add c.Value, c.Value
Next c
Next j
Me.ComboBox9.List = MonDico2.items
End If
Next i
End Sub
Mais j'ai une erreur 457, cette clé est déjà associée à un élément de de cette collection