Private Sub Workbook_BeforePrint(Cancel As Boolean)
'Code de MichD
Dim Sh As Worksheet, Arr(), A As Integer
Dim NomFeuille As String, Elt As Variant
'************Variables à définir********************
NomFeuille = "Feuil1" 'Nom de l'onglet de la feuille dont
'tu veux imprimer en portrait et paysage
'Adresse des 2 plages à imprimer (Portrait - Paysage)
Arr = Array("A1:AD48", "AF1:BN30")
'****************************************************
For Each Sh In ActiveWindow.SelectedSheets
Cancel = False
If UCase(Sh.Name) = UCase(NomFeuille) Then
For Each Elt In Arr
'Première adresse en portrait
If A = 0 Then
With Sh
With .PageSetup
.PrintArea = Elt
.CenterFooter = ThisWorkbook.Name
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlPortrait
End With
End With
A = A + 1
Else
'L'autre adresse en paysage.
With Sh
With .PageSetup
.PrintArea = Elt
.CenterFooter = ThisWorkbook.Name
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
End With
End With
End If
Application.EnableEvents = False
Sh.PrintPreview 'en remplacer après par .PrintOut
Sh.PageSetup.PrintArea = ""
Application.EnableEvents = True
Next
Cancel = True
End If
Next
End Sub