'mot clef
Private Sub B_ok_Click()
With Me.ListBox2
.Clear
i = 0
Set plage = f.Range("a2:a" & f.Cells(Rows.Count, 1).End(xlUp).Row)
Set c = plage.Find(Me.MotCle, , , xlPart)
If Not c Is Nothing Then
premier = c.Address
Do
Trouve = True
.AddItem f.Cells(c.Row, 1)
.List(.ListCount - 1, 1) = c.Row
Set c = plage.FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
If Trouve = False Then
Call MsgBox("" & "" _
& vbCrLf & "Non trouvé" _
, vbInformation, Application.Name)
Exit Sub
End If
pointeur = 0
LIGNE: LIGNE = Me.ListBox2.List(pointeur, 1)
Affiche
End With
End Sub
'recherche par référence
Private Sub B_ok2_Click()
With Me.ListBox2
.Clear
i = 0
Set plage = f.Range("b2:b" & f.Cells(Rows.Count, 2).End(xlUp).Row)
'expression.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
'Set c = plage.Find(Me.Reference, , ,xlPart xlValue, xlByColumns)
Set c = plage.Find(Me.Reference, , , xlWhole, xlByColumns)
If Not c Is Nothing Then
premier = c.Address
Do
Trouve = True
.AddItem f.Cells(c.Row, 1)
.List(.ListCount - 1, 1) = c.Row
Set c = plage.FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
If Trouve = False Then
Call MsgBox("" & "" _
& vbCrLf & "Non trouvé" _
, vbInformation, Application.Name)
Exit Sub
End If
pointeur = 0
LIGNE: LIGNE = Me.ListBox2.List(pointeur, 1)
Affiche
End With
End Sub