Bonjour tibo,
Pourquoi ne pas avoir dis tout ça depuis le début
Ça change pas mal de truc.
Un code à mettre dans le code de la feuille contenant la sélection. Il faudra peut-être l'adapter un peu (au niveau des noms de feuille peut-être... si ta 2è feuille ne s'appelle pas Feuil2).
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim plage1 As Range, plage2 As Range, c As Range, champ As Range, cel As Range
Dim rouge As Long, bleu&, vert&
Dim FeuilDonnee As Worksheet
Set plage1 = Range([b2], [b2].End(xlDown)) 'première plage de données
Set plage2 = Range([d2], [d2].End(xlDown)) 'deuxième plage de données
rouge = 5066944
bleu = 14857357
vert = 5880731
With Application
If .Intersect(Target, Range(plage1, plage2)) Is Nothing _
And .Intersect(Target, [A11]) Is Nothing And .Intersect(Target, [G5]) Is Nothing Then Exit Sub
End With
If Not Application.Intersect(Target, plage1) Is Nothing And Target.Count = 1 Then Target.Interior.Color = rouge
If Not Application.Intersect(Target, plage2) Is Nothing And Target.Count = 1 Then Target.Interior.Color = rouge
Set FeuilDonnee = Sheets("Feuil2")
With FeuilDonnee
If Target.Address = "$A$11" Then 'si clic sur cellule A11 on affiche tout
plage1.Interior.Color = bleu
plage2.Interior.Color = vert
.Cells.EntireColumn.Hidden = False: .Cells.EntireRow.Hidden = False
Exit Sub
End If
If Not Application.Intersect(Target, [G5]) Is Nothing Then 'si clic sur G5 (valider)
'traitement de la plage 1
Set champ = Nothing
.Cells.EntireRow.Hidden = False
For Each cel In plage1
If cel.Interior.Color = rouge Then
Set c = .Range("a4:a" & .Range("a" & Rows.Count).End(xlUp).Row).Find(cel, lookat:=xlWhole)
Set c = .Range(.Range(c.Address), c.End(xlDown).Offset(-1))
If champ Is Nothing Then
Set champ = c
Else
Set champ = Union(champ, c)
End If
End If
Next cel
If Not champ Is Nothing Then
.Rows("4:164").Hidden = True
champ.EntireRow.Hidden = False
End If
'traitement de la plage 2
Set champ = Nothing
.Cells.EntireColumn.Hidden = False
For Each cel In plage2
If cel.Interior.Color = rouge Then
Set c = .Range("e1:x2").Find(cel, lookat:=xlWhole)
If champ Is Nothing Then
Set champ = c
Else
Set champ = Union(champ, c)
End If
End If
Next cel
If Not champ Is Nothing Then
.Range("F:Y").EntireColumn.Hidden = True
champ.EntireColumn.Hidden = False
End If
.Select
End If
End With
End Sub