Bonjour,

Dans la continuité de mon projet de créer un "annuaire à citations", je me permets de créer un topic concernant une nouvelle problématique.

J'ai créé dans mon document un module de recherche dans lequel je peux taper un mot et qui va chercher si ce mot est présent dans une colonne définie (la colonne K).

Nom : image_2021-03-10_193642.png
Affichages : 145
Taille : 21,0 Ko

Les résultats sont affichés sur une listbox qui me donne l'ID correspondant pour aller la chercher. Cependant j'aimerai que lorsque je clique sur le résultat de la listebox, il m'emmène directement à la ligne du tableau concernée.

Quelqu'un aurait-il une idée ?

J'ai joins le fichier excel au besoin (voir Citations.xlsm) sinon le code est le suivant :

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
29
30
31
32
33
34
35
36
37
38
Private Sub TextBox1_Change()
 
    Application.ScreenUpdating = False
 
    Range("A7:A1000").Interior.ColorIndex = 0 'enlève la couleur lorsqu'on vide la recherche sur la colonne A
    Range("B7:B1000").Interior.ColorIndex = 0
    Range("C7:C1000").Interior.ColorIndex = 0
    Range("D7:D1000").Interior.ColorIndex = 0
    Range("E7:E1000").Interior.ColorIndex = 0
    Range("F7:F1000").Interior.ColorIndex = 0
    Range("G7:G1000").Interior.ColorIndex = 0
    Range("H7:H1000").Interior.ColorIndex = 0
    Range("I7:H1000").Interior.ColorIndex = 0
    Range("J7:H1000").Interior.ColorIndex = 0
    Range("K7:H1000").Interior.ColorIndex = 0
    ListBox1.Clear
 
    If TextBox1 <> "" Then 'Si la boite de recherche n'est pas vide
        For ligne = 7 To 100 'champs où la recherche est faites
            If Cells(ligne, 11) Like "*" & TextBox1 & "*" Then 'Si la cellule de la 1ère colonne correspond à la recherche
                Cells(ligne, 1).Interior.ColorIndex = 8 'surligne la 1ère colonne de la ligne en vert
                Cells(ligne, 2).Interior.ColorIndex = 8
                Cells(ligne, 3).Interior.ColorIndex = 8
                Cells(ligne, 4).Interior.ColorIndex = 8
                Cells(ligne, 5).Interior.ColorIndex = 8
                Cells(ligne, 6).Interior.ColorIndex = 8
                Cells(ligne, 7).Interior.ColorIndex = 8
                Cells(ligne, 8).Interior.ColorIndex = 8
                Cells(ligne, 9).Interior.ColorIndex = 8
                Cells(ligne, 10).Interior.ColorIndex = 8
                Cells(ligne, 11).Interior.ColorIndex = 8
                ListBox1.AddItem Cells(ligne, 1)
 
            End If
        Next
    End If
 
End Sub
Vous remerciant par avance de l'aide apportée ou du temps consacré.