1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
Private Sub TextBox1_Change()
Dim Plage As Range, Cell As Range
Dim Recherche As String, Adresse As String
Dim Ligne As Integer, N As Integer
Dim C As Range
Dim Prix As Double
ListBox1.Clear
N = 0
Recherche = TextBox1.Value
Prix = TextBox2.Value
Range("A1").Select
With Feuil2
Set Plage = .Range(.Cells(1, 2), .Cells(.Rows.Count, 2).End(xlUp))
End With
With Plage
Set C = .Find(Recherche)
If Not C Is Nothing Then
Adresse = C.Address
Do
If UCase(Recherche) = UCase(Left(C, Len(Recherche))) Then
If C.Offset(, 1) = Prix Then
'alimentation listBox
ListBox1.AddItem C.Offset(0, -1), N
ListBox1.List(N, 1) = C
ListBox1.List(N, 2) = C.Offset(0, 1)
ListBox1.List(N, 3) = C.Offset(0, 2)
ListBox1.List(N, 4) = C.Offset(0, 3)
N = N + 1
End If
End If
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> Adresse
End If
End With
End Sub |
Partager