Bonjour,
Je ne sais pas si j'ai bien compris le problème...
En tout cas, j'ai fait quelques aménagements :
- coloration des lignes alternée de ton tableau d'échéance mise en MFC
- la macro prendra en compte la date figurant en I24 pour extraire l'échéance (si I24 est vide elle prend la date du jour), cela permet de diversifier l'extraction à la demande (et diversifier les tests sans rien modifier !)
La proc. rattachée à ton image (loupe) :
Sub Echéance()
Dim Alt(), d As Object, k, col, mt, de, Rng As Range, i%, j%
With Worksheets("BD")
Set Rng = .Range("C6:J" & .Range("C" & .Rows.Count).End(xlUp).Row)
End With
col = Array(1, 6, 8)
de = IIf(ActiveSheet.Range("I24") <> "", ActiveSheet.Range("I24").Value2, Date)
Set d = CreateObject("Scripting.Dictionary")
With Rng
For i = 1 To .Rows.Count
If .Cells(i, 7) = de Then
For j = 0 To UBound(col)
k = k & "|" & .Cells(i, col(j)).Value2
Next j
If d.exists(k) Then
mt = Val(Replace(d(k), ",", "."))
d(k) = mt + .Cells(i, 5)
Else
d(k) = .Cells(i, 5)
End If
k = ""
End If
Next i
End With
If d.Count > 0 Then
ReDim Alt(d.Count - 1, 4): j = 0
For Each k In d.keys
Alt(j, 2) = Val(Replace(d(k), ",", ".")): Alt(j, 3) = de
k = Split(k, "|")
Alt(j, 0) = k(1): Alt(j, 1) = k(2): Alt(j, 4) = k(3)
j = j + 1
Next k
End If
Application.ScreenUpdating = False
With ActiveSheet.Range("B26")
.CurrentRegion.Offset(1).ClearContents
If d.Count > 0 Then .Resize(j, 5).Value = Alt
End With
End Sub
A toi de tester.
Cordialement.
edit : Salut Patrick !