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
| Private Sub TxtFix_Change()
Nbmax = Sheets("Base").Range("A100000").End(xlUp).Row
If Me.TxtFix <> "" Then
Me.TextNom = ""
Me.TxtMob = ""
Me.ListClient.Clear
Me.ListFix.Clear
Me.ListMob.Clear
Dim tm As Single
tm = Timer
Dim tTab(), tExtract()
Dim iIdx%
tTab = Range("A2:J" & Range("E" & Rows.Count).End(xlUp).Row).Value
If Len(Me.TxtFix) >= 2 Then
For x = 1 To UBound(tTab, 1)
For y = 2 To UBound(tTab, 2)
If InStr(UCase(tTab(x, y)), UCase(Me.TxtFix.Value)) > 0 Then
iIdx = iIdx + 1
ReDim Preserve tExtract(7, iIdx)
tExtract(0, iIdx - 1) = tTab(x, 1) + 1
tExtract(1, iIdx - 1) = tTab(x, 5)
tExtract(2, iIdx - 1) = tTab(x, 6)
tExtract(3, iIdx - 1) = tTab(x, 7)
tExtract(4, iIdx - 1) = tTab(x, 8)
tExtract(5, iIdx - 1) = tTab(x, 9)
tExtract(6, iIdx - 1) = tTab(x, 10)
If y <> 5 Then tExtract(2, iIdx - 1) = tTab(x, y)
Exit For
End If
Next
Next
End If
Me.ListClent.List = tExtract(1)
Me.ListFix.List = tExtract(2) & tExtract(3) & tExtract(4)
Me.ListMob.List = tExtract(5) & tExtract(6)
MsgBox "Durée d'exécution: " & Timer - tm & " s"
End If
End Sub |
Partager