Bonjour

Pourquoi dans ma macro l'ajustement à la largeur de la page ne fonctionne pas ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ActiveSheet.Select
 
cp = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
 
With ActiveSheet
    With .PageSetup
         .FitToPagesWide = 1 'lageur  de la  zone
         .PaperSize = xlPaperA4  'format papier
         .Orientation = xlLandscape  'paysage
         .CenterHorizontally = True  'centré horizontalement
         .CenterVertically = False    'centré verticalement
         .PrintTitleRows = Rows("1:2").Address 'répeter les titres
         .LeftMargin = Application.InchesToPoints(0)   'marge gauche
         .RightMargin = Application.InchesToPoints(0)  'marge droite
         .TopMargin = Application.InchesToPoints(0)    'marge haut
         .BottomMargin = Application.InchesToPoints(0) 'marge bas
         .PrintArea = "A1:G" & cp     'zone d'impression
     End With
End With