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
|
Private Sub ComboBox1_Change()
'type structure
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
ListBox1.Clear
n = 0
Recherche = ComboBox1.Value
Range("K2").Select
Ligne = Sheets("BDD").Range("K" & "65536").End(xlUp).Row
Set Plage = Sheets("BDD").Range("K" & "2:" & "K" & Ligne)
With Plage
Set C = .Find(Recherche, , xlValues)
If Not C Is Nothing Then
Adresse = C.Address
Do
If UCase(Recherche) = UCase(Left(C, Len(Recherche))) Then
ListBox1.AddItem C.Offset(0, 0), n
ListBox1.List(n, 0) = C
ListBox1.List(n, 1) = C.Offset(0, -1)
ListBox1.List(n, 2) = C.Offset(0, 1)
ListBox1.List(n, 3) = C.Offset(0, 4)
ListBox1.List(n, 4) = C.Offset(0, -10)
ListBox1.List(n, 5) = C.Offset(0, -9)
ListBox1.List(n, 6) = C.Offset(0, -8)
ListBox1.List(n, 7) = C.Offset(0, 5)
ListBox1.List(n, 8) = C.Offset(0, 7)
n = n + 1
End If
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> Adresse
End If
End With
End Sub |
Partager