Bonsoir,
A voir si cela convient :
Sub ListerPlanning()
Dim Pln(), t%, a%, n%, i%, p%, agt$
n = [Travaux].Rows.Count
For a = 1 To [ListAgents].Rows.Count
agt = [ListAgents].Cells(a, 1)
ReDim Pln(1, n): t = -1
With [Travaux]
For i = 1 To n
If .Cells(i, 4) = agt And .Cells(i, 2) = "En cours" Then
t = t + 1
Pln(0, t) = .Cells(i, 1)
Pln(1, t) = .Cells(i, 3)
End If
Next i
End With
With Worksheets("Planning")
p = p + 2: .Cells(p, 1) = agt
If t = -1 Then GoTo notvx
ReDim Preserve Pln(1, t)
p = p + 1
.Cells(p, 1).Resize(t + 1, 2).Value = WorksheetFunction.Transpose(Pln)
p = p + t
End With
notvx:
Next a
agt = "Travaux à faire"
ReDim Pln(1, n): t = -1
With [Travaux]
For i = 1 To n
If .Cells(i, 4) = "" And .Cells(i, 2) = "A faire" Then
t = t + 1
Pln(0, t) = .Cells(i, 1)
Pln(1, t) = .Cells(i, 3)
End If
Next i
End With
With Worksheets("Planning")
If t = -1 Then
.Activate: Exit Sub
End If
ReDim Preserve Pln(1, t): p = p + 2
.Cells(p, 1) = agt: p = p + 1
.Cells(p, 1).Resize(t + 1, 2).Value = WorksheetFunction.Transpose(Pln)
.Activate
End With
End Sub
Mes excuses Andrea...