bonjour mikael57fr rjamin le forum
une methode comme j' ai compris!!!
colonne b=ref1
colonne c=ref2
colonne d =ref3
tu selectionne la colonne b puis insertion/nom/definir
ref1 pour le nom
dans reference a:
=DECALER(Feuil1!$B$2;;;NBVAL(Feuil1!$B:$B)-1)
idem pour les 2 autres colonnes
ref2
=DECALER(Feuil1!$C$2;;;NBVAL(Feuil1!$C:$C)-1)
ref3
=DECALER(Feuil1!$D$2;;;NBVAL(Feuil1!$D:$D)-1)
tes 3 plages sont nommees
dans userform 3 combobox
code
1 2 3 4 5 6 7 8 9
| Option Explicit
Dim c As Variant, MonDico As Object, i As Long, temp
Private Sub UserForm_Initialize()
Set MonDico = CreateObject("Scripting.Dictionary")
For Each c In Range("ref1")
If Not MonDico.Exists(c.Value) Then MonDico.Add c.Value, c.Value
Next c
Me.ComboBox1.List = MonDico.items
End Sub |
1 2 3 4 5 6 7 8 9 10 11 12
| Private Sub ComboBox1_Change()
Set MonDico = CreateObject("Scripting.Dictionary")
For i = 1 To Range("ref2").Count
If Range("ref1")(i) = Me.ComboBox1 Then
temp = Range("ref2")(i)
If Not MonDico.Exists(temp) Then MonDico.Add temp, temp
End If
Next i
Me.ComboBox2.List = MonDico.items
Me.ComboBox2.ListIndex = -1
Me.ComboBox3.ListIndex = -1
End Sub |
1 2 3 4 5 6 7 8 9 10
| Private Sub ComboBox2_Change()
Set MonDico = CreateObject("Scripting.Dictionary")
For i = 1 To Range("ref3").Count
If Range("ref2")(i) = Me.ComboBox2 And Range("ref1")(i) = Me.ComboBox1 Then
temp = Range("ref3")(i)
If Not MonDico.Exists(temp) Then MonDico.Add temp, temp
End If
Next i
Me.ComboBox3.List = MonDico.items
End Sub |
Partager