bonjour a vous tous
j'essai d'intégrer un code d'option bouton dans un autre fichier et apparement il y aurais des variables non sélectionné et pourtant elle fonctionne bien dans le fichier d'ou le code est issu
donc voici le code de l'activation de l'usf qui ne reconnait pas Cell et i
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Private Sub UserForm_activate()
    Set Sh = Sheets("prestation")
    Me.lstArticle.Clear
    For Each Cell In Sh.Range(Sh.[D2], Sh.[D65536].End(xlUp))
        With Me.lstArticle
        If Cell.Value = Me.lstDescription.Text Then
            .AddItem Sh.Cells(Cell.Row, 1)
            i = .ListCount - 1
            Me.lstArticle.List(i, 1) = Sh.Cells(Cell.Row, 2)
            Me.lstArticle.List(i, 2) = Sh.Cells(Cell.Row, 3)
            Me.lstArticle.List(i, 3) = Sh.Cells(Cell.Row, 4)
            Me.lstArticle.List(i, 4) = Sh.Cells(Cell.Row, 7)
            Me.lstArticle.List(i, 5) = Sh.Cells(Cell.Row, 5)
 
 
        Else
        End If
     End With
     Next Cell
   End Sub
et celui de l'optionbutton
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Private Sub OptionButton1_Click()
    Set Sh = Sheets("prestation")
    Dim NoDescription As New Collection
 
    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
        Else
            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
 
End Sub
rg ,i et J non déclarée?

cordialement

Pascal