XL 2016 Probléme listbox

MASSJIPE

XLDnaute Impliqué
Bonjour le forum
J'ai un soucis la listbox de mon userform ,l'appel du formulaire ce fait en colonne J le problème c'est qu'il affiche le mot est gobelet au lieu des références Ex R100279065
Merci
VB:
Private Sub ListBox1_Click()
    With Sheets("Frontal")
        lig = .Cells(Rows.Count, 10).End(xlUp).Row + 0
     
        For i = 0 To ListBox1.ListCount - 1
            If ListBox1.Selected(i) = True Then
                .Cells(lig, 10) = ListBox1.List(i)
                rw = Application.Match(ListBox1.List(i), Sheets("REF").Columns(10), 0)
               
            End If
        Next i
    End With
    Unload Me
End Sub

Private Sub UserForm_Initialize()
Dim c As Range
Dim tablo()
Dim i As Integer, j As Integer
Dim temp As String
Dim present As Boolean

    ListBox1.ColumnCount = 1
    ListBox1.ColumnWidths = "50"

    With Sheets("REF")
        ReDim tablo(1 To 1)
        tablo(1) = .Cells(2, 3)
        For Each c In .Range("B2:B" & .Range("B65536").End(xlUp).Row)
            present = False
            For i = 1 To UBound(tablo)
                If tablo(i) = c Then present = True
            Next i
            If Not present Then
                ReDim Preserve tablo(1 To UBound(tablo) + 1)
                tablo(UBound(tablo)) = c
            End If
            For i = 1 To UBound(tablo)
                For j = 1 To UBound(tablo)
                    If tablo(i) < tablo(j) Then
                        temp = tablo(i)
                        tablo(i) = tablo(j)
                        tablo(j) = temp
                    End If
                Next j
            Next i
        Next c
    End With
    ListBox1.List = tablo
End Sub
 

Pièces jointes

  • test.xlsm
    3.7 MB · Affichages: 6

Discussions similaires

Statistiques des forums

Discussions
311 725
Messages
2 081 947
Membres
101 849
dernier inscrit
florentMIG