Private Sub CommandButton1_Click()
Dim DerLig As Long, i As Long, aff As Worksheet
'Impression des affectations des véhicules au format A4
Set aff = Sheets("Feuil3")
With aff
DerLig = .Cells.Find("*", , , , xlByRows, xlPrevious).Row 'dernière ligne
With .PageSetup
.PrintTitleRows = "$d$1:$F$1" 'Copie 5 lignes sur chaque page
.PrintArea = "d1:F" & DerLig 'Impression jusqu'à dernière ligne
.PaperSize = xlPaperA4 'Format A4
.Orientation = xlPortrait 'Impression portrait
.LeftMargin = Application.InchesToPoints(0.25) 'définition des marges
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.25)
.Zoom = False
.FitToPagesTall = 1 'adaptation hauteur feuille
.FitToPagesWide = 1 'adaptation largeur feuille
End With
.PrintPreview
End With
End Sub