Function TotalProduits(produit$, x)
Dim w As Worksheet, col%
Application.Volatile
If IsDate(x) Then
    x = CLng(x)
    For Each w In Worksheets
        If w.Name <> "Totaux" And Not IsDate("1/" & w.Name) Then
            col = Application.Match(x, w.Rows(3), 0)
            TotalProduits = TotalProduits + Application.VLookup(produit, w.Columns(1).Resize(, col), col, 0)
        End If
    Next
Else
    Set w = Sheets(CStr(x))
    x = CLng(Application.Caller.Parent.[B1])
    col = Application.Match(x, w.Rows(3), 0)
    TotalProduits = Application.VLookup(produit, w.Columns(1).Resize(, col), col, 0)
End If
End Function
Sub AjouterMois()
Dim x$, w As Worksheet, col%
x = Sheets(Sheets.Count).Name
If Not IsDate("1/" & x) Then MsgBox "La dernière feuille doit être un mois !", vbCritical: Exit Sub
x = Application.Proper(Format(CDate("1/" & x) + 31, "mmmm yyyy"))
If MsgBox("Voulez-vous créer le mois " & x & " ?", vbYesNo, "Ajouter Mois") = vbNo Then Exit Sub
Application.ScreenUpdating = False
Sheets(Sheets.Count).Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = x
ActiveSheet.[B1] = CDate("1/" & x)
For Each w In Worksheets
    If Not IsDate("1/" & w.Name) Then
        col = w.Cells(3, w.Columns.Count).End(xlToLeft).Column + 1
        If col > 3 Then
            w.Columns(col).Insert
            w.Columns(col - 1).Copy w.Columns(col)
            On Error Resume Next 'si aucune SpecialCell
            w.Columns(col).SpecialCells(xlCellTypeConstants).ClearContents
            w.Cells(3, col) = CDate("1/" & x)
        End If
    End If
Next w
End Sub
Sub AjouterNom()
Dim x As Variant, w As Worksheet, col%
Do
    x = Application.InputBox("Entrez le nom :", "Ajouter Nom", CStr(x))
    If x = "" Or x = False Then Exit Sub
    x = UCase(x)
    On Error Resume Next
    Set w = Sheets(UCase(x))
    On Error GoTo 0
    If w Is Nothing Then
        Application.ScreenUpdating = False
        Sheets("VIERGE").Copy Before:=Sheets("Totaux")
        ActiveSheet.Name = x
        ActiveSheet.DrawingObjects.Delete
        ActiveSheet.[B1] = x
        For Each w In Worksheets
            If IsDate("1/" & w.Name) Then
                col = w.Cells(3, w.Columns.Count).End(xlToLeft).Column + 1
                If col > 3 Then
                    w.Columns(col).Insert
                    w.Columns(col - 1).Copy w.Columns(col)
                    w.Cells(3, col) = x
                End If
            End If
        Next w
        Exit Sub
    Else
        MsgBox "Le nom " & x & " existe déjà", vbCritical
    End If
Loop
End Sub
Sub SupprimerMois()
Dim x$, w As Worksheet, col%
x = Sheets(Sheets.Count).Name
If Not IsDate("1/" & x) Then MsgBox "La dernière feuille doit être un mois !", vbCritical: Exit Sub
If MsgBox("Voulez-vous supprimer le mois " & x & " ?", vbYesNo, "Supprimer Mois") = vbNo Then Exit Sub
Application.DisplayAlerts = False
Sheets(x).Delete
For Each w In Worksheets
    For col = w.Cells(3, w.Columns.Count).End(xlToLeft).Column To 4 Step -1
        If w.Cells(3, col) = CDate("1/" & x) Then w.Columns(col).Delete
Next col, w
End Sub
Sub SupprimerNom()
Dim x As Variant, w As Worksheet, col%
x = Application.InputBox("Entrez le nom à supprimer :", "Supprimer Nom")
If x = "" Or x = False Then Exit Sub
x = UCase(x)
If x = "VIERGE" Or x = "TOTAUX" Or IsDate("1/" & x) Then Exit Sub
On Error Resume Next
Set w = Sheets(x)
On Error GoTo 0
If w Is Nothing Then Exit Sub
Application.DisplayAlerts = False
w.Delete
For Each w In Worksheets
    For col = w.Cells(3, w.Columns.Count).End(xlToLeft).Column To 4 Step -1
        If w.Cells(3, col) = UCase(x) Then w.Columns(col).Delete
Next col, w
End Sub