1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Private Sub CommandButton1_Click()
Dim CHOIX
CHOIX = TextBox1.Value
'Effacer la liste LISTE
ListBox1.Clear
'Remplir le tableau LISTE après filtrage
For I = 2 To 20
If Range("A" & I).Value = CHOIX Then
Me.ListBox1.AddItem (Range(" B" & I))
Me.ListBox1.List(ListBox1.ListCount - 1, 0) = Range("A" & I)
Me.ListBox1.List(ListBox1.ListCount - 1, 1) = Range("B" & I)
Me.ListBox1.List(ListBox1.ListCount - 1, 2) = Range("C" & I)
End If
Next I
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
If Me.ListBox1.ListIndex > -1 Then
Me.Tag = Me.ListBox1.ListIndex
UserForm3.TextBox1 = Me.ListBox1.List(Me.ListBox1.ListIndex, 0)
UserForm3.TextBox2 = Me.ListBox1.List(Me.ListBox1.ListIndex, 1)
UserForm3.TextBox3 = Me.ListBox1.List(Me.ListBox1.ListIndex, 2)
UserForm3.Show
End If
End Sub
Sub modifier()
For I = 1 To 20
k = Sheets("feuil1").Range("A" & I).Value
j = Sheets("feuil1").Range("B" & I).Value
If k = Me.ListBox1.List(Me.ListBox1.ListIndex, 0) And j = Me.ListBox1.List(Me.ListBox1.ListIndex, 1) Then
k = UserForm3.TextBox1.Value
j = UserForm3.TextBox2.Value
End If
Next I
UserForm3.Hide
End Sub |