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
| Private Sub OptionButton4_Click()
Dim Sh As Worksheet
Dim Rg As Range
Dim NoDescription As New Collection
Dim A '<-- doit être déclaré "Variant" pour pouvoir recevoir un Range
Dim I As Integer
Dim J As Integer
Set Sh = Sheets("prestation")
On Error Resume Next
Set Rg = Sh.Range(Sh.[D2], Sh.[D65536].End(xlUp))
A = Rg.Value
For I = 1 To UBound(A, 1)
If A(I, 1) <> "" Then
NoDescription.Add A(I, 1), CStr(A(I, 1))
End If
Next I
Me.lstDescription.Clear
For J = 1 To NoDescription.Count
Me.lstDescription.AddItem NoDescription(J)
Next J
Me.lstDescription.ListIndex = 0
Me.lstArticle.Clear
End Sub |