bonjours a tous,
Je vous explique mon problème...
Grace a certain du forum(qui ont fait beaucoup) j'ai fait un classeur excel avec plusieurs feuilles qui contienne des tableau avec des informations et le dernière feuille est dédier a la recherche avec un textbox et une listbox, si je clique sur le résultat afficher dans ma listbox ça m’amène directement sur la ligne concerné dans la page concerné et ça la surligne en jaune ( Interior.ColorIndex = 6)
Le problème est que quand j'efface mon texte dans la textbox la ligne reste jaune et ne reviens pas a la couleur initiale (Interior.ColorIndex = 37)
Si jamais vous avez une solutions je suis preneur !
Merci par avance !
Je vous joint le code vba et le dossier anonymiser
Option Compare Text
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim L_index As Long
L_index = ListBox1.ListIndex
Cells(Tablo(L_index), 1).Activate
End Sub
Private Sub TextBox1_Change()
Application.ScreenUpdating = False
Dim sh As Integer, c As Range, firstAddress As String
ListBox1.Clear
For sh = 1 To Sheets.Count
If sh.Name <> "Annuaire" Then
With Worksheets(sh).Cells
Set c = .Find(TextBox1.Value, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
ListBox1.AddItem c.Value
ListBox1.List(ListBox1.ListCount - 1, 1) = sh.Name
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End If
Next
Exit Sub
Erase Tablo()
Range("A2:j" & Range("A" & Rows.Count).End(xlUp).Row).Interior.ColorIndex = 37
ListBox1.Clear
Cpt = 0
If TextBox1 <> "" Then
For ligne = 2 To Range("A" & Rows.Count).End(xlUp).Row
If Cells(ligne, 1) Like "*" & TextBox1 & "*" Then
Range(Cells(ligne, 1), Cells(ligne, 10)).Interior.ColorIndex = 6
ListBox1.AddItem Cells(ligne, 1)
ReDim Preserve Tablo(Cpt + 1)
Tablo(Cpt) = ligne
Cpt = Cpt + 1
End If
Next
End If
End Sub