bonjour a vous tous
j'ai ce code qui fonctionne tres bien avec une listbox mais comment faire pour qu'il fonctionne dans une listview
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Sub Cherche(x As String)
    Dim C As Range, firstAddress As String
 
    Application.ScreenUpdating = False
    With Ws
        Set C = .Columns(3).Find(x, LookIn:=xlValues, lookat:=xlPart)
        If Not C Is Nothing Then
            firstAddress = C.Address
            Do
                If Left(C, Len(x)) = x Then
                    travaux.ListBox1.Item C.Offset(, -1)
                    travaux.ListBox1.List(travaux.ListBox1.ListCount - 1, 1) = C
                    travaux.ListBox1.List(travaux.ListBox1.ListCount - 1, 2) = C.Offset(, 1)
                    travaux.ListBox1.List(travaux.ListBox1.ListCount - 1, 3) = C.Offset(, 2)
                End If
                Set C = .Columns(3).FindNext(C)
            Loop While Not C Is Nothing And C.Address <> firstAddress
        End If
    End With
    Application.ScreenUpdating = True
 
End Sub
j'ai déja fait ceci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
travaux.ListView1.listItems.Cells(C.Row, 2)
                travaux.ListView1.ListItems(travaux.ListView1.ListItems.Count - 1, 1) = .Cells(C.Row, 3)
                travaux.ListView1.ListItems(travaux.ListView1.ListItems.Count - 1, 2) = .Cells(C.Row, 4)
                travaux.ListView1.ListItems(travaux.ListView1.ListItems.Count - 1, 3) = .Cells(C.Row, 5)
mais ca coince des la première ligne

cordialement


Pascal