Message erreur dans VB : erreur de compilation Attendu séparateur de liste

Bonjour

Ci joint un fichier excell pour lequel j'essaie de construire une textbox de recherche situé dans l,onglet Bd

Voici mon code et en ROUGE et GRAS la ou ca bloque

Je joins le fichier evidememnt

4test-find.xlsm (31.04 Ko)

Private Sub TextBox1_Change()
Dim ws As Worksheet
Dim lastrow As Long
Dim i As Long, j As Long
Dim searchText As String
Dim found As Boolean

Set ws = ThisWorkbook.Sheets("Base de données")
lastrow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
searchText = LCase(Me.TextBox1.Value)
If ws.AutoFilterMode Then
ws.AutoFilterMode = False
End If
If searchText = "" Then
ws.Rows.Hidden = False
Exit Sub
End If
For i = 3 To lastrow
found = False

For j = 1 To 13
' If InStr(1, LCase(ws.Cells(i, j).Value, searchText, vbTextCompare)>0 Then
found = True



Exit For
End If
ws.Rows(i).Hidden = Not found
Next i

End Sub

corrigé!

Private Sub TextBox1_Change()

    Dim ws As Worksheet
    Dim lastrow As Long
    Dim i As Long, j As Long
    Dim searchText As String
    Dim found As Boolean

    Set ws = ThisWorkbook.Sheets("Base de données")
    lastrow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
    searchText = LCase(Me.TextBox1.Value)

    ' Réinitialiser l'affichage
    ws.Rows.Hidden = False

    ' Si le TextBox est vide, on sort
    If searchText = "" Then Exit Sub

    ' Parcourir les lignes
    For i = 3 To lastrow
        found = False

        ' Parcourir les colonnes A à M (1 à 13)
        For j = 1 To 13
            If InStr(1, LCase(ws.Cells(i, j).Value), searchText, vbTextCompare) > 0 Then
                found = True
                Exit For
            End If
        Next j

        ' Masquer ou afficher la ligne
        ws.Rows(i).Hidden = Not found
    Next i

End Sub

Wow ! Merci beaucoup

Rechercher des sujets similaires à "message erreur compilation attendu separateur liste"