Option Explicit
Sub Clic_Mois(Optional x As Byte)
'
Dim Tp0 As Single, i As Byte, lft As Single, NomSh As String
    Application.ScreenUpdating = False
 
    With Sheets("Plannings")
        Tp0 = .Rows(6).Top - 2
        lft = 2 + .Columns(5).Left
        For i = 1 To 12
            With .Shapes("Ms" & i)
                .Height = 20
                .Top = Tp0 - .Height
                .Left = lft
                .Width = 62.5
                .Fill.ForeColor.RGB = &HDEC4B0
                .TextFrame2.TextRange.Characters.Font.Fill.ForeColor.RGB = &HF0F0F0
                lft = lft + .Width + 1.5
            End With
        Next i
        NomSh = IIf(Left(Application.Caller, 2) = "Ms", Application.Caller, "Ms" & x)
        With .Shapes(NomSh)
            .Height = 30
            .Top = Tp0 - .Height
            .Fill.ForeColor.RGB = &HED9564
            .TextFrame2.TextRange.Characters.Font.Fill.ForeColor.RGB = 0
        End With
        If Left(Application.Caller, 2) = "Ms" Then
            .Range("A4").Value = Replace(Application.Caller, "Ms", "")
            Dim Col As Range, Rw As Range, LastRow As Long, Trow As Integer
            Trow = 9 ' ligne des jours du mois
            ' masquage colonnes
            For Each Col In Columns("AE:AG").Columns
                Col.Hidden = Col.Rows(Trow) = ""
            Next
'            ' masquage lignes
            Rows(Trow + 1 & ":" & Rows.Count).Hidden = False
            LastRow = Cells(Rows.Count, "B").End(xlUp).Row
            If LastRow >= Trow + 1 Then
                For Each Rw In Rows(Trow + 1 & ":" & LastRow).Rows
                    Rw.Hidden = Rw.Columns("AI") = 0
                Next
            End If
        End If
    End With
End Sub