Améliorer la rapidité d'exécution

reno421 Messages postés 47 Statut Membre -  
f894009 Messages postés 17413 Statut Membre -
Bonjour,


Je sollicite à nouveau votre aide. J''ai créé un marco qui fait automatiquement la mise en pages de mets feuille excel (cf. ci-dessous) . Le hic c'est qu'elle met beaucoup de trop de temps pour s'exécuter. Comment puis-je l'améliorer pour diminuer le temps d'exécution ?

D'vaance merci pour votre réponse.


Sub paysage()
'
' Mise en page au format A4 en mode paysage avec en-tête et pied de page personalisé
'
     Dim Compteur As Integer, Nom As String
        Application.DisplayAlerts = False
        Application.ScreenUpdating = False
            For Compteur = Worksheets.Count To 1 Step -1
                Nom = Sheets(Compteur).Name
                Select Case Nom
                Case "INFO", "PAA-VLT", "site 61 63"
                Case Else
                        With ActiveSheet.PageSetup
                            .LeftHeader = ""
                            .CenterHeader = "&""Arial,Gras""&20&UPLAN ANNUEL D'INTERVENTION"
                            .RightHeader = ""
                            .LeftFooter = "&8&F" & Chr(10) & "&A"
                            .CenterFooter = ""
                            .RightFooter = "&8&D" & Chr(10) & "Page &P/&N"
                            .LeftMargin = Application.InchesToPoints(0.7)
                            .RightMargin = Application.InchesToPoints(0.7)
                            .TopMargin = Application.InchesToPoints(0.75)
                            .BottomMargin = Application.InchesToPoints(0.75)
                            .HeaderMargin = Application.InchesToPoints(0.3)
                            .FooterMargin = Application.InchesToPoints(0.3)
                            .PrintHeadings = False
                            .PrintGridlines = False
                            .PrintComments = xlPrintNoComments
                            .PrintQuality = 600
                            .CenterHorizontally = True
                            .CenterVertically = True
                            .Orientation = xlLandscape
                            .Draft = False
                            .PaperSize = xlPaperA4
                            .FirstPageNumber = xlAutomatic
                            .Order = xlDownThenOver
                            .BlackAndWhite = False
                            .Zoom = 75
                            .PrintErrors = xlPrintErrorsDisplayed
                            .OddAndEvenPagesHeaderFooter = False
                            .DifferentFirstPageHeaderFooter = False
                            .ScaleWithDocHeaderFooter = True
                            .AlignMarginsHeaderFooter = True
                            .EvenPage.LeftHeader.Text = ""
                            .EvenPage.CenterHeader.Text = ""
                            .EvenPage.RightHeader.Text = ""
                            .EvenPage.LeftFooter.Text = ""
                            .EvenPage.CenterFooter.Text = ""
                            .EvenPage.RightFooter.Text = ""
                            .FirstPage.LeftHeader.Text = ""
                            .FirstPage.CenterHeader.Text = ""
                            .FirstPage.RightHeader.Text = ""
                            .FirstPage.LeftFooter.Text = ""
                            .FirstPage.CenterFooter.Text = ""
                            .FirstPage.RightFooter.Text = ""
                        End With
                     
                End Select
            Next Compteur
            Application.DisplayAlerts = True
            Application.ScreenUpdating = True

End Sub

3 réponses

reno421 Messages postés 47 Statut Membre
 
Rectification ca marche mais c'est tres tres lent. comment puis-je augmenter la rapidité d'exécution ?
0
pilas31 Messages postés 1878 Statut Contributeur 646
 
Bonjour,

Je pense qu'il y a une petite erreur car cela agit toujours sur la feuille active.

il faut sans doute remplacer
With ActiveSheet.PageSetup

par
With Sheets(Compteur).PageSetup
0
reno421 Messages postés 47 Statut Membre
 
Bonjour Pilas, c'est la même chose car j'incrémente chaque fois de page.
En fait, je fait une mise en page séquentielle (page par page). Celà prend beaucoup de temps. y a--til un moyen plus rapide ?
0
f894009 Messages postés 17413 Statut Membre 1 715
 
0