Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim dercol_calend As Integer
Dim C As Long
' repère la dernière colonne de la ligne 2
dercol_calend = Cells(2, Columns.Count).End(xlToLeft).Column
' Tous les salariés
'******************************************************************************************************
If Cells(2, 1) = "TOUS" Then
Columns("A:AL").EntireColumn.Hidden = False
Cells(1, 1).Select
End If
' autres salariés
'******************************************************************************************************
If Cells(2, 1) = "autres" Then
'réaffichage tous les salariés
Columns("A:AL").EntireColumn.Hidden = False
Cells(1, 1).Select
For C = 2 To dercol_calend
If Cells(2, C) = "BH" Then Columns(C).Hidden = True
If Cells(2, C) = "FP" Then Columns(C).Hidden = True
If Cells(2, C) = "LP" Then Columns(C).Hidden = True
Next C
End If
' projets
'******************************************************************************************************
If Cells(2, 1) = "projets" Then
'réaffichage tous les salariés
Columns("A:AL").EntireColumn.Hidden = False
Cells(1, 1).Select
For C = 2 To dercol_calend
If Cells(2, C) = "BH" Then Columns(C).Hidden = True
If Cells(2, C) = "FP" Then Columns(C).Hidden = True
If Cells(2, C) = "LP" Then Columns(C).Hidden = True
If Cells(2, C) = "JA" Then Columns(C).Hidden = True
If Cells(2, C) = "BF" Then Columns(C).Hidden = True
If Cells(2, C) = "FKM" Then Columns(C).Hidden = True
If Cells(2, C) = "XO" Then Columns(C).Hidden = True
Next C
End If
' SAV
'******************************************************************************************************
If Cells(2, 1) = "SAV" Then
'réaffichage tous les salariés
Columns("A:AL").EntireColumn.Hidden = False
Cells(1, 1).Select
For C = 2 To dercol_calend
If Cells(2, C) = "BH" Then Columns(C).Hidden = True
If Cells(2, C) = "FP" Then Columns(C).Hidden = True
If Cells(2, C) = "LP" Then Columns(C).Hidden = True
If Cells(2, C) = "JA" Then Columns(C).Hidden = True
If Cells(2, C) = "BF" Then Columns(C).Hidden = True
If Cells(2, C) = "KM" Then Columns(C).Hidden = True
If Cells(2, C) = "XO" Then Columns(C).Hidden = True
If Cells(2, C) = "ED" Then Columns(C).Hidden = True
If Cells(2, C) = "PF" Then Columns(C).Hidden = True
If Cells(2, C) = "MG" Then Columns(C).Hidden = True
If Cells(2, C) = "AG" Then Columns(C).Hidden = True
If Cells(2, C) = "AL" Then Columns(C).Hidden = True
If Cells(2, C) = "IM" Then Columns(C).Hidden = True
If Cells(2, C) = "RO" Then Columns(C).Hidden = True
If Cells(2, C) = "SP" Then Columns(C).Hidden = True
If Cells(2, C) = "PP" Then Columns(C).Hidden = True
If Cells(2, C) = "SR" Then Columns(C).Hidden = True
If Cells(2, C) = "ER" Then Columns(C).Hidden = True
If Cells(2, C) = "GR" Then Columns(C).Hidden = True
If Cells(2, C) = "MW" Then Columns(C).Hidden = True
Next C
End If
' commerciaux
'******************************************************************************************************
If Cells(2, 1) = "commerciaux" Then
'réaffichage tous les salariés
Columns("A:AL").EntireColumn.Hidden = False
Cells(1, 1).Select
For C = 2 To dercol_calend
If Cells(2, C) = "BB" Then Columns(C).Hidden = True
If Cells(2, C) = "MD" Then Columns(C).Hidden = True
If Cells(2, C) = "JA" Then Columns(C).Hidden = True
If Cells(2, C) = "RD" Then Columns(C).Hidden = True
If Cells(2, C) = "GD" Then Columns(C).Hidden = True
If Cells(2, C) = "MK" Then Columns(C).Hidden = True
If Cells(2, C) = "PM" Then Columns(C).Hidden = True
If Cells(2, C) = "PO" Then Columns(C).Hidden = True
If Cells(2, C) = "TR" Then Columns(C).Hidden = True
Next C
End If
End Sub