1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Private Sub UserForm_Activate()
Dim Cellules As Range
Dim N&, j&
Application.ScreenUpdating = False
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
For j = Cellules.Row + 1 To Cellules.End(xlDown).Row
If Sheets(N).Cells(j, Cellules.Column) = 0 And Sheets(N).Cells(j, Cellules.Column + 1) = 0 Then
Sheets(N).Cells(j, 1).EntireRow.Hidden = True
End If
Next j
'LbFeuilles.AddItem Sheets(N).Name
End If
Next
Next N
End Sub
Private Sub CmdExportPDF_Click()
Dim Chemin$, Fiche$, NomFiche$
Dim SheetArray() As Variant
Dim I&, Indx&
Chemin = ThisWorkbook.Path & Application.PathSeparator
Fiche = "Liasses Syscohada"
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 |
Partager