Re-,
et en complément, je n'avais pas prévu le cas où il n'y aurait pas de passeports, ni de cartes Sncf à traiter..
Avec la même procédure que ci-dessus, remplace toute cette partie de code :
temp1 = Application.Transpose(EcheancePsP.keys)
Temp2 = Application.Transpose(EcheancePsP.items)
For I = 1 To EcheancePsP.Count
Me.ListBox1.AddItem
Me.ListBox1.List(I, 0) = Temp2(I, 1)
Me.ListBox1.List(I, 1) = Cells(temp1(I, 1), 5)
Next I
Set EcheanceSncf = CreateObject("Scripting.Dictionary")
For Each Cel In Range("G2:G" & Derlig)
If DateValue(Cel) < DateSerial(Year(Date), Month(Date) + 2, Day(Date)) Then
EcheanceSncf.Item(Cel.Row) = Cel.Offset(0, -6).Value
End If
Next Cel
temp3 = Application.Transpose(EcheanceSncf.keys)
Temp4 = Application.Transpose(EcheanceSncf.items)
For I = 1 To EcheanceSncf.Count
Me.ListBox2.AddItem
Me.ListBox2.List(I, 0) = Temp4(I, 1)
Me.ListBox2.List(I, 1) = Cells(temp3(I, 1), 7)
Next I
par celle-ci :
If EcheancePsP.Count > 0 Then
temp1 = Application.Transpose(EcheancePsP.keys)
Temp2 = Application.Transpose(EcheancePsP.items)
For I = 1 To EcheancePsP.Count
Me.ListBox1.AddItem
Me.ListBox1.List(I, 0) = Temp2(I, 1)
Me.ListBox1.List(I, 1) = Cells(temp1(I, 1), 5)
Next I
End If
Set EcheanceSncf = CreateObject("Scripting.Dictionary")
For Each Cel In Range("G2:G" & Derlig)
If DateValue(Cel) < DateSerial(Year(Date), Month(Date) + 2, Day(Date)) Then
EcheanceSncf.Item(Cel.Row) = Cel.Offset(0, -6).Value
End If
Next Cel
If EcheanceSncf.Count > 0 Then
temp3 = Application.Transpose(EcheanceSncf.keys)
Temp4 = Application.Transpose(EcheanceSncf.items)
For I = 1 To EcheanceSncf.Count
Me.ListBox2.AddItem
Me.ListBox2.List(I, 0) = Temp4(I, 1)
Me.ListBox2.List(I, 1) = Cells(temp3(I, 1), 7)
Next I
End If
Bon courage