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 57 58 59 60 61 62
|
Function FiltreTotal()
Application.Volatile
feuille = Application.Caller.Parent.Name
chaine = ""
For c = 1 To Sheets(feuille).Range("_FilterDataBase").Columns.Count
If FiltreActuelNo(c) <> "" Then
If IsDate(Sheets(feuille).Range("_FilterDataBase").Cells(2, c)) Then
chaine = chaine & Sheets(feuille).Range("_FilterDataBase").Cells(1, c) & FiltreActuelNo(c, "D") & " "
Else
chaine = chaine & Sheets(feuille).Range("_FilterDataBase").Cells(1, c).Value & FiltreActuelNo(c) & " "
End If
End If
Next c
If chaine = "" Then chaine = "Tout"
FiltreTotal = chaine
End Function
Function FiltreActuelNo(col, Optional typeCol As String)
feuille = Application.Caller.Parent.Name
Application.Volatile
If Sheets(feuille).FilterMode Then
If Sheets(feuille).AutoFilter.Filters.Item(col).On Then
temp = Sheets(feuille).AutoFilter.Filters.Item(col).Criteria1
If Left(temp, 2) = ">=" Or Left(temp, 2) = "<=" Then
o = Left(temp, 2): n = Mid(temp, 3)
Else
If Left(temp, 1) = "=" Or Left(temp, 1) = ">" Or Left(temp, 1) = "<" Then
o = Left(temp, 1): n = Mid(temp, 2)
Else
n = temp
End If
End If
If typeCol = "D" Then n = Format(n, "dd/mm/yy")
temp = o & n
'---
If Sheets(feuille).AutoFilter.Filters.Item(col).Operator Then
oper = IIf(Sheets(feuille).AutoFilter.Filters.Item(col).Operator = 1, " ET ", " OU ")
On Error Resume Next
Err = 0
temp2 = Sheets(feuille).AutoFilter.Filters.Item(col).Criteria2
If Err = 0 Then
If Left(temp2, 2) = ">=" Or Left(temp2, 2) = "<=" Then
o = Left(temp2, 2): n = Mid(temp2, 3)
Else
If Left(temp2, 1) = "=" Or Left(temp2, 1) = ">" Or Left(temp2, 1) = "<" _
Then o = Left(temp2, 1): n = Mid(temp2, 2)
End If
If typeCol = "D" Then n = Format(n, "dd/mm/yy")
temp2 = o & n
Else
oper = ""
End If
End If
FiltreActuelNo = temp & oper & temp2
Else
FiltreActuelNo = ""
End If
Else
FiltreActuelNo = ""
End If
End Function |
Partager