Re : bouton de recherche
bonsoir a tous
j'ai réussi a avancé (grâce a vous)mais il me reste une erreur de code. mon but faire une recherche dans une colonne a (nom de lieux dit) et récupérer le résultat de la colonne c.
le useform est crée mais il doit y avoir une erreur dans le code dont je me suis servi
Private Sub UserForm_Click()
Option Explicit
Option Base 1
Option Compare Text
Private Sub L1_Click()
Dim lig&
If L1.ListIndex <> -1 Then
lig = L1.List(L1.ListIndex, L1.ColumnCount)
adresse.Select: adresse.Rows(lig).Select
ActiveWindow.ScrollRow = lig
Application.ScreenUpdating = 1
End If
End Sub
Private Sub T1_Change()
Dim i&, fin&, y&, a&, aa, bb, lig&, col&
Application.ScreenUpdating = 0
If T1 = "" Then L1.Clear: Exit Sub
L1.Clear
With Feuil1
y = 1
fin = .Range("A" & Rows.Count).End(xlUp).Row
col = .Cells(1, Columns.Count).End(xlToLeft).Column + 2
If fin < 2 Then fin = 2: Exit Sub
aa = .Range(.Cells(2, 1), .Cells(fin, col))
End With
For i = 1 To UBound(aa)
aa(i, UBound(aa, 2) - 1) = i + 1
aa(i, UBound(aa, 2)) = ""
Next i
For i = 1 To UBound(aa)
For a = 1 To UBound(aa, 2)
If aa(i, a) Like "*" & T1 & "*" Then aa(i, UBound(aa, 2)) = "oui": y = y + 1: Exit For
Next a
Next i
If y = 1 Then Exit Sub
ReDim bb(y - 1, UBound(aa, 2) - 1)
y = 1
For i = 1 To UBound(aa)
If aa(i, UBound(aa, 2)) = "oui" Then
For a = 1 To UBound(aa, 2) - 1
bb(y, a) = aa(i, a)
Next a
y = y + 1
End If
Next i
With L1
.ColumnCount = UBound(aa, 2) - 2
.List = bb
End With
End Sub
pourriez vous m'aider sachant que ma feuille s'appelle "adresse"
encore un grand grand merci