Re : USF recherche de Thierry
J'ai essayé un truc comme ça mais ça me crée a chaque fois une nouvelle ligne:
'Aide de Excel_Lent et pierrejean et thierry sur XLD
Private Sub RechercheGo_Click()
Dim C As Range
Dim Tablo() As String
Dim Text As String
Dim Text2 As String
Dim S As Byte
Dim Firstaddress As String
Dim i As Integer, X As Integer, num_result As Integer
Dim Compte As Integer
num_result = 0
ListView1.ListItems.Clear
TextBox20.SetFocus
Text = Me.TextBox20
If Text = "" Then
MsgBox ("Veuillez renseigner ce que vous cherchez voyons!!!"), vbInformation
TextBox20.SetFocus
Exit Sub
End If
For S = 1 To Worksheets.Count
With Sheets(S).UsedRange
Set C = .Find(Text, LookIn:=xlValues, LookAt:=xlPart)
If Not C Is Nothing Then
Firstaddress = C.Address
Do
num_result = num_result + 1
ReDim Preserve Tablo(34, i)
For X = 1 To 31
'Tablo(X - 1, i) = C.Offset(0, X - C.Column).Text
With ListView1
.ListItems.Add , , C.Offset(0, X - C.Column).Text
With .ListItems(.ListItems.Count)
.ListSubItems.Add , , C.Offset(0, X - C.Column).Text
.ListSubItems.Add , , C.Offset(0, X - C.Column).Text
.ListSubItems.Add , , C.Offset(0, X - C.Column).Text
End With
End With
Next X
'Tablo(32, i) = Sheets(S).Name
'Tablo(33, i) = C.Address(0, 0)
i = i + 1
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> Firstaddress
End If
End With
Next S
If i <> 0 Then
'Me.ListBox1.Column() = Tablo()
TextBox21.Value = num_result
End If
If i = 0 Then
MsgBox ("Le Texte " & Text & " n'a pas été trouvé dans le fichier de suivi"), vbCritical
TextBox20 = ""
Exit Sub
End If
End Sub