Private Sub Worksheet_Activate()
Worksheet_Change [A1] 'lance la macro
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [A1]) Is Nothing Then Exit Sub
Dim mois As Byte, lig&, col%, w As Worksheet, i&, j As Variant, k%, s#
Application.ScreenUpdating = False
Rows("2:" & Rows.Count).ClearContents 'RAZ
If Not IsDate("1/" & [A1]) Then Exit Sub
mois = Month("1/" & [A1])
lig = 3: col = 2
For Each w In Worksheets
If IsDate(w.Range("B2")) Then
Cells(lig, 1) = w.Name
For i = 3 To w.Cells(w.Rows.Count, 1).End(xlUp).Row
If w.Cells(i, 1) <> "" Then
j = Application.Match(w.Cells(i, 1), Rows(2), 0)
If IsError(j) Then Cells(2, col) = w.Cells(i, 1): j = col: col = col + 1
s = 0
For k = 2 To w.Cells(2, w.Columns.Count).End(xlToLeft).Column
If IsDate(w.Cells(2, k)) Then _
If Month(w.Cells(2, k)) = mois Then _
If IsNumeric(w.Cells(i, k)) Then s = s + w.Cells(i, k)
Next k
Cells(lig, j) = s
End If
Next i
lig = lig + 1
End If
Next w
Application.DisplayAlerts = False
Rows(1).UnMerge 'défusionne
[B1].Resize(, Columns.Count - 1).Clear 'RAZ à droite
Rows(1).Resize(, col - 1).Merge 'fusionne
Rows(2).HorizontalAlignment = xlCenter 'centrage
Rows(2).VerticalAlignment = xlCenter
End Sub