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
| Private Sub CommandButton1_Click()
With Sheets("Taches")
Sheets("Taches").Select
ActiveSheet.Unprotect "****"
Range("$B$1:$N$6000").AutoFilter Field:=13
Range("$B$1:$N$6000").AutoFilter Field:=2
Range("$B$1:$N$6000").AutoFilter Field:=8
Range("$B$1:$N$6000").AutoFilter Field:=3
'1 - filtre "CONTIENT" les initiales des employés (en masquant les taches terminées)
If ComboBox1 <> "" Then
.Range("$B$16:$N$6001").AutoFilter Field:=13, Criteria1:="=*Range(p1)*", Operator:=xlFilterValues
ActiveSheet.Range("$B$17:$N$6000").AutoFilter Field:=8, Criteria1:="<>Terminé", Operator:=xlAnd
End If
'2 - filtre les catégories (en masquant les taches terminées)
If ComboBox2 <> "" Then
.Range("$B$1:$N$6000").AutoFilter Field:=2, Criteria1:=Array(ComboBox2.Text), Operator:=xlFilterValues
ActiveSheet.Range("$B$17:$N$6000").AutoFilter Field:=8, Criteria1:="<>Terminé", Operator:=xlAnd
End If
'3 - filtre l'état d'avancement
If ComboBox3 <> "" Then
.Range("$B$1:$N$6000").AutoFilter Field:=8, Criteria1:=Array(ComboBox3.Text), Operator:=xlFilterValues
End If
'4 - filtre les délais fixés (en masquant les taches terminées)
If ComboBox4 <> "" Then
.Range("$B$1:$N$6000").AutoFilter Field:=3, Criteria1:=Array(ComboBox4.Text), Operator:=xlFilterValues
ActiveSheet.Range("$B$17:$N$6000").AutoFilter Field:=8, Criteria1:="<>Terminé", Operator:=xlAnd
End If
End With
ComboBox1.Clear
ComboBox2.Clear
ComboBox3.Clear
ComboBox4.Clear
Application.GoTo Range("A1"), True
Range("C3").Select
Unload Me
UserForm5.Show
Application.ScreenUpdating = True
ActiveSheet.Protect "****", DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowFormattingCells:=True, AllowSorting:=True, AllowFiltering:= _
True, AllowUsingPivotTables:=True
ActiveWorkbook.save
End Sub |
Partager