Sinon, pour plus de clarté, je joinds le code VBA et le FIchier. J'avoue que je ne comprends pas pourquoi j'ai des 0 à la place alors que les dates sont au format "date".
L'objectif : faire la somme des montant compris pour chaque mois entre le 1er (debut) et la date du jour (fin).
A noter qu'on aura un problème pour Frévrier qui s’arrête à 28 ou 29.
Le code :
Sub ADD()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim Fich As String, Chemin As String, Wb As Workbook
Dim c As Range, Teste As Variant, Plage As Range, Ligne As Long, Period As String
Dim Col As Integer, debut As Integer, fin As Integer, n As Currency, dernligne As Integer
Set ws = ThisWorkbook
debut = 1
fin = Day(Date)
m = ws.Sheets("operation_Quit_01").Range("A65536").End(xlUp).Row
With ws.Sheets("operation_Quit_01")
dernligne = ws.Sheets("operation_Quit_01").Range("A" & .Rows.Count).End(xlUp).Row
Set MaplageRECH = ws.Sheets("operation_Quit_01").Range("C2:C" & dernligne)
Set MaplageADD = ws.Sheets("operation_Quit_01").Range("G2:G" & dernligne)
ws.Sheets("Resultat").Range("C11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/01/2019", MaplageRECH, fin & "/01/2019"), "#,##0")
ws.Sheets("Resultat").Range("D11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/02/2019", MaplageRECH, fin & "/02/2019"), "#,##0") '"fin" ne doit pas dépasser le 28 ou le 29...mais comment faire ?
ws.Sheets("Resultat").Range("E11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/03/2019", MaplageRECH, fin & "/03/2019"), "#,##0")
ws.Sheets("Resultat").Range("F11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/04/2019", MaplageRECH, fin & "/04/2019"), "#,##0")
ws.Sheets("Resultat").Range("G11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/05/2019", MaplageRECH, fin & "/05/2019"), "#,##0")
ws.Sheets("Resultat").Range("H11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/06/2019", MaplageRECH, fin & "/06/2019"), "#,##0")
ws.Sheets("Resultat").Range("I11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/07/2019", MaplageRECH, fin & "/07/2019"), "#,##0")
ws.Sheets("Resultat").Range("J11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/08/2019", MaplageRECH, fin & "/08/2019"), "#,##0")
ws.Sheets("Resultat").Range("K11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/09/2019", MaplageRECH, fin & "/09/2019"), "#,##0")
ws.Sheets("Resultat").Range("L11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/10/2019", MaplageRECH, fin & "/10/2019"), "#,##0")
ws.Sheets("Resultat").Range("M11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/11/2019", MaplageRECH, fin & "/11/2019"), "#,##0")
ws.Sheets("Resultat").Range("N11") = Format(Application.WorksheetFunction.SumIfs(MaplageADD, MaplageRECH, ">=" & debut & "/12/2019", MaplageRECH, fin & "/12/2019"), "#,##0")
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub