Bonjour à tous,

J'ai créé une ListBox dans laquelle plusieurs éléments se répètent, j'aimerais ne pas avoir de doublons dans cette ListBox. J'ai cherché un peu partout, mais je ne trouve rien de très simple. J'ai aussi tenté "If PlotForm.TimeList.ListIndex = -1 Then" mais cela ne fonctionne pas... Voici le morceau de code en question:

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
21
22
23
24
25
26
27
28
Dim i As Long
    Dim j As Long
    Dim Cell As Range
    Dim strTemp As String
 
    Sheets(LoggerParamChoiceTrends.ChoiceList.Text).Activate
 
    With ActiveSheet
        For Each Cell In Range([B10], [B10].End(xlToRight))
            Cell.Activate
            LoggerParamChoiceTrends.LoggerChoice.AddItem Split(Cell.Value, "@")(1)
        Next Cell
    End With
 
    'Sorts choices with alphabetical order
        With LoggerParamChoiceTrends.LoggerChoice
            For i = 0 To .ListCount - 1
                For j = 0 To .ListCount - 1
                    If .List(i) < .List(j) Then
                        strTemp = .List(i)
                        .List(i) = .List(j)
                        .List(j) = strTemp
                    End If
                Next j
            Next i
        End With
 
    Application.Goto Range("A1"), True
Si quelqu'un peut m'éclairer, je suis preneur pour toute idée