Bonjour à tous
je cherche à afficher le résultat d'une recherche sur listbox1 (2 colonnes) dans lisbox2 sur 2 colonnes
je rentre le mot recherche dans la textbox4
je clic sur le CommandButton2 qui lance la Macro ci dessous
Private Sub CommandButton2_Click()
Dim Cherche As String
Dim L As Integer
Dim Maplage As Range
Dim FirstADdress As String
Dim C As Object
Cherche = TextBox4
If Cherche = "" Then
Exit Sub
End If
With ListBox2
.ColumnCount = 2
.ColumnWidths = "90;90"
.Visible = True
End With
L = Sheets("Database").Range("A65536").End(xlUp).Row
Set Maplage = Sheets("Database").Range("A2:B" & L)
With Maplage
Set C = .Find(Cherche, LookIn:=xlValues)
If Not C Is Nothing Then
FirstADdress = C.Address
Do
ListBox2.AddItem C
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> FirstADdress
End If
End With
End Sub
mon résultat dans la listbox2 n'est que sur une colonne
je cherche à modifier cette macro pour obtenir le résultat recherché
Merci pour votre aide
je cherche à afficher le résultat d'une recherche sur listbox1 (2 colonnes) dans lisbox2 sur 2 colonnes
je rentre le mot recherche dans la textbox4
je clic sur le CommandButton2 qui lance la Macro ci dessous
Private Sub CommandButton2_Click()
Dim Cherche As String
Dim L As Integer
Dim Maplage As Range
Dim FirstADdress As String
Dim C As Object
Cherche = TextBox4
If Cherche = "" Then
Exit Sub
End If
With ListBox2
.ColumnCount = 2
.ColumnWidths = "90;90"
.Visible = True
End With
L = Sheets("Database").Range("A65536").End(xlUp).Row
Set Maplage = Sheets("Database").Range("A2:B" & L)
With Maplage
Set C = .Find(Cherche, LookIn:=xlValues)
If Not C Is Nothing Then
FirstADdress = C.Address
Do
ListBox2.AddItem C
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> FirstADdress
End If
End With
End Sub
mon résultat dans la listbox2 n'est que sur une colonne
je cherche à modifier cette macro pour obtenir le résultat recherché
Merci pour votre aide