Find next si résultat pas correct combobox

Bonjour,

J'ai un code, qui permet de chercher une valeur dans la colonne 3 onglet Dbase, je souhaite renvoyer la valeur dans une listebox la valeur de la colonne 1 de la feuille Dbase

Cela concerne la combobox 2 et bouton recherche CommandButton1.

Je souhaite afficher l'ensemble des résultats FoundAt dans la listbox.

Si vous avez un avis.

Private Sub CommandButton1_Click()
    Dim oRange As Range, aCell As Range, bCell As Range
    Dim ws As Worksheet
    Dim SearchString As String, FoundAt As String

    On Error GoTo Whoa

    Set ws = Worksheets("Dbase")
    Set oRange = ws.Columns(3)

     SearchString = Me.ComboBox2

    Set aCell = oRange.Find(What:=SearchString, LookIn:=xlValues, _
                LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
                MatchCase:=False, SearchFormat:=False)

    If Not aCell Is Nothing Then
        Set bCell = aCell
        FoundAt = aCell.Address
        Do
            Set aCell = oRange.FindNext(After:=aCell)

            If Not aCell Is Nothing Then
                If aCell.Address = bCell.Address Then Exit Do
                FoundAt = FoundAt & ", " & aCell.Address
            Else
                Exit Do
            End If
        Loop
    Else
        MsgBox SearchString & " not Found"
        Exit Sub
    End If

    MsgBox "The Search String has been found these locations: " & FoundAt
    Exit Sub

Whoa:
    MsgBox Err.Description
End Sub

Merci.

Bonjour

Tu devrais joindre ton fichier....

Bye !

Salut gmb,

voici le fichier, trop lourd via le forum.

https://drive.google.com/file/d/0B0jVAtuEpwDKT3NEVDVNTThYa2s/view?usp=sharing

Pourrais-tu passer par www.cjoint.com ?

J'ai des problèmes ...

Bye !

Un essai à tester, si tant est que j'ai bien compris...

Bye !

Hello gmb,

ça fonctionne au top, merci

J’étais embourbé de ce code ahah, tu m'as sorti de l’ornière.

Bonne journée.

Rechercher des sujets similaires à "find next resultat pas correct combobox"