Bonjour
a mettre dans userform
Private Sub UserForm_Initialize()
End Sub
Private Sub UserForm_Activate()
Set Sh = Feuil1
With ComboBox1
For I = 2 To Sh.Range("A" & Rows.Count).End(xlUp).Row
If Sh.Range("A" & I) <> "" Then
.Value = Sh.Range("A" & I).Text
If .ListIndex = -1 Then .AddItem Sh.Range("A" & I) ' Existe t-il?
End If
Next I
.ListIndex = -1
End With
End Sub
Private Sub ComboBox1_Change()
ComboBox2.Clear
ListBox1.Clear
If ComboBox1.ListIndex = -1 Then Exit Sub
With Feuil1
For I = 3 To .Cells(1, Columns.Count).End(xlToLeft).Column
ComboBox2.AddItem .Cells(1, I)
Next I
End With
End Sub
Private Sub ComboBox2_Change()
InitList
End Sub
Private Sub InitList()
Set Sh = Feuil1
Nlig = Sh.Range("A" & Rows.Count).End(xlUp).Row
With ListBox1
.Clear
For L = 2 To Nlig
If Sh.Cells(L, 1) = ComboBox1.Value Then
.AddItem Sh.Cells(L, 2).Text ' Num?ro de la ligne
.List(.ListCount - 1, 1) = L
End If
Next
End With
End Sub
A+
Maurice