‘redim la zone d’impression en fonction du nombre de ligne et de colonnes et imprime la feuille
Sub Imprimer(feuille, nbPer, nbPrd)
On Error Resume Next 'evite une erreur d'absence d'imprimante
If Application.Dialogs(xlDialogPrinterSetup).Show = False Then Exit Sub
On Error GoTo 0
Application.ScreenUpdating = False
With Sheets(feuille)
With .PageSetup
.Orientation = xlLandscape 'paysage
.CenterHorizontally = True 'centré horizontalement
.CenterVertically = True 'centré verticalement
.PrintArea = Cells(6, 1).Address & ":" & Cells(nbPer, nbPrd).Address 'zone d'impression
.LeftMargin = Application.InchesToPoints(0) 'marge gauche
.RightMargin = Application.InchesToPoints(0) 'marge droite
.TopMargin = Application.InchesToPoints(0) 'marge haut
.BottomMargin = Application.InchesToPoints(0) 'marge bas
.Zoom = False 'pas de zoom
.FitToPagesTall = 1 '1 page en hauteur
.FitToPagesWide = 1 '1 page en largeur
End With
.PrintOut 'imprime
End With
Application.ScreenUpdating = True
End Sub