Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("B2,D2")) Is Nothing Then Exit Sub
Cancel = True
Filtre Target
End Sub
Sub Filtre(Target As Range)
Dim F1 As Worksheet, F2 As Worksheet, plage As Range
Set F1 = Sheets("Tous les projets")
Set F2 = Sheets("Projets apprenti")
On Error Resume Next 'si le nom n'est pas trouvé
F1.[B:D].Replace Target, 1, LookAt:=xlWhole
Set plage = F1.[B:D].SpecialCells(xlCellTypeConstants, 1)
F1.Cells.Copy F2.Cells 'pour les dimensions des colonnes
F2.Cells.Clear
Union(F1.Rows(1), plage.EntireRow).Copy F2.[A1]
F2.[B2:D65536].SpecialCells(xlCellTypeConstants, 2).ClearContents
F2.[B:D].Replace 1, Target
F1.[B:D].Replace 1, Target
F2.Activate 'facultatif
End Sub