Private Sub CmdExportPDF_Click()
Dim Chemin$, Fiche$, NomFiche$
Dim SheetArray() As Variant
Dim I&, Indx&
Chemin = ThisWorkbook.Path & Application.PathSeparator
Fiche = "Test"
Indx = 0
For I = 0 To LbFeuilles.ListCount - 1
If LbFeuilles.Selected(I) Then
ReDim Preserve SheetArray(Indx)
SheetArray(Indx) = LbFeuilles.List(I)
Indx = Indx + 1
End If
Next I
If Indx > 0 Then
Application.ScreenUpdating = False
Sheets(SheetArray()).Select
NomFiche = Chemin & Fiche
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=NomFiche, _
Quality:=xlQualityMinimum, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End If
Erase SheetArray
Feuil1.Select
Unload Me
Application.Goto [A1], True
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim Cellules As Range
For N = 1 To Sheets.Count
For Each Cellules In Sheets(N).UsedRange
If Cellules = "Année N" And Cellules.Offset(0, 1) = "Année N-1" Then
' Réouverture des lignes masquées
Sheets(N).Cells.EntireRow.Hidden = False
End If
Next
Next N
End Sub