Sub Attestations()
Dim t#, chemin, i&, nom$, prenom$
t = Timer
chemin = ThisWorkbook.Path & "\Attestations\"
If Dir(chemin, vbDirectory) = "" Then MkDir chemin 'création du sous-dossier
With Feuil1.[A1].CurrentRegion
For i = 2 To .Rows.Count
nom = .Cells(i, 8)
prenom = .Cells(i, 7)
With Feuil2
.Cells(8, 3) = nom
.Cells(8, 4) = prenom
.ExportAsFixedFormat xlTypePDF, chemin & nom & " " & prenom
End With
Next
End With
MsgBox i - 2 & " attestation(s) créée(s) en " & Format(Timer - t, "0.00 \s")
End Sub