Améliorer la rapidité d'exécution

Fermé
reno421 Messages postés 41 Date d'inscription vendredi 30 janvier 2015 Statut Membre Dernière intervention 16 septembre 2015 - Modifié par reno421 le 11/02/2015 à 11:47
f894009 Messages postés 17185 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 15 avril 2024 - 12 févr. 2015 à 15:19
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 41 Date d'inscription vendredi 30 janvier 2015 Statut Membre Dernière intervention 16 septembre 2015
11 févr. 2015 à 11:44
Rectification ca marche mais c'est tres tres lent. comment puis-je augmenter la rapidité d'exécution ?
0
pilas31 Messages postés 1825 Date d'inscription vendredi 5 septembre 2008 Statut Contributeur Dernière intervention 24 avril 2020 643
11 févr. 2015 à 11:49
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 41 Date d'inscription vendredi 30 janvier 2015 Statut Membre Dernière intervention 16 septembre 2015
11 févr. 2015 à 12:41
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 17185 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 15 avril 2024 1 701
12 févr. 2015 à 15:19
0