Bonjour Michel, Salut Bruno,
Voici une proposition avec une macro nommée calcul :
Sub calcul()
With ActiveSheet
dl = .Cells(.Rows.Count, 4).End(xlUp).Row
t = .Range("D1:E" & dl).Value
if dl < 3 then exit sub
For i = 3 To UBound(t)
If t(i, 1) <> "" Then somme = somme + t(i, 1) Else somme = 0
If .Cells(i + 1, 4).Value = "" Then t(i, 2) = somme Else t(i, 2) = ""
Next i
.Cells(1, 4).Resize(dl, 2).Value = t
End With
End Sub
exécutée lors d'un changement sur la colonne B (j'ai pour l'instant gardé toute la colonne car j'ai supposé que ce serait suffisant et que tester les dates ne serait pas nécessaire) :
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns(2)) Is Nothing Then Call calcul
End Sub
Cdlt,