Option Explicit
Sub Test()
Dim onglet() As String
Dim dl As Long, x As Long
Dim sNomFichierPDF As String, bFeuille As Boolean
dl = Feuil4.Range("A" & Rows.Count).End(xlUp).Row
For x = 0 To dl - 1
ReDim Preserve onglet(x)
onglet(x) = Feuil4.Cells(x + 1, 1)
bFeuille = FeuilleVide(onglet(x))
If bFeuille Then Exit For
Next x
If bFeuille Then
MsgBox "Attention feuille vide : " & onglet(x), vbOKOnly + vbCritical
Exit Sub
End If
Application.ScreenUpdating = False
Sheets(onglet).Select
sNomFichierPDF = ThisWorkbook.Path & "\" & "Essai.pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=sNomFichierPDF, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Feuil4.Select
Application.ScreenUpdating = True
End Sub
Private Function FeuilleVide(sNomFeuille As String) As Boolean
FeuilleVide = False
If WorksheetFunction.CountA(Worksheets(sNomFeuille).UsedRange) = 0 And _
Worksheets(sNomFeuille).Shapes.Count = 0 Then
FeuilleVide = True
End If
End Function