Sub PDF()
Dim ncol%, tablo, ub&, Code As Range, Stage As Range, R As Range, rc&, cc%, i&, resu(), j&, col%, k%, lig&
With Sheets("liste").[A1].CurrentRegion
    .Sort .Cells(1), xlAscending, Header:=xlYes
    ncol = .Columns.Count
    If ncol < 2 Then ncol = 2
    tablo = .Resize(.Rows.Count + 1, ncol) 'matrice, plus rapide, 1 ligne de plus
    ub = UBound(tablo) - 1
End With
With Sheets("Lettre")
    If .FilterMode Then .ShowAllData 'si la feuille est filtrée
    Set Code = .[B6] 'à adapter
    Set Stage = .[B10:B38] 'à adapter
    Set R = .[E10:AC38] 'à adapter
    rc = R.Rows.Count: cc = R.Columns.Count
    Application.ScreenUpdating = False
    For i = 2 To ub
        Code = tablo(i, 1) 'Code 3D
        ReDim resu(1 To rc, 1 To cc) 'RAZ
        col = -1
        For j = i To ub
            col = col + 2
            resu(1, col) = tablo(j, 2) 'Codes 5D
            For k = 3 To ncol
                lig = Application.Match(tablo(1, k), Stage, 0)
                resu(lig, col) = tablo(j, k)
            Next k
            If tablo(j + 1, 1) <> tablo(j, 1) Then
                R = resu 'restitution
                .ExportAsFixedFormat xlTypePDF, ThisWorkbook.Path & "\" & tablo(i, 1) & " - Suivi formations.pdf"
                i = j
                Exit For
            End If
    Next j, i
End With
End Sub