Bonjour,
J'essaie d'optimiser la macro ci-dessous. J'ai identifié une section qui est très lente à exécuter pour chaque onglet à travers lesquels elle passe. Il s'agit de la section qui fait la mise en page pour impression. Est-ce que quelqu'un peut m'aider?
Je suis ouverte à toute suggestion d'amélioration pour cette section et le reste du code! Un gros merci!
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 Sub MacroA() 'Traite toutes les feuilles du fichier Dim x As Integer Application.ScreenUpdating = False For x = 1 To Sheets.Count R_Index_GLOBAL_2 Sheets(x) Next x Application.ScreenUpdating = True End Sub Sub R_Index_GLOBAL_2(ByVal FeuilleEnTraitement As Worksheet) '=============================== 'Début Section lente '=============================== With FeuilleEnTraitement.PageSetup .PrintArea = "" .LeftMargin = Application.InchesToPoints(0.037401575) .RightMargin = Application.InchesToPoints(0.037401575) .TopMargin = Application.InchesToPoints(0.734251969) .CenterHorizontally = True .Orientation = xlLandscape .PaperSize = 5 .Zoom = 100 End With '=============================== 'Fin Section lente '=============================== With FeuilleEnTraitement.Cells .Font.Name = "Arial" .Font.Size = 5 .VerticalAlignment = xlTop End With With FeuilleEnTraitement.Rows .EntireRow.AutoFit End With With FeuilleEnTraitement .Columns("A:A").ColumnWidth = 11.86 .Columns("B:B").ColumnWidth = 64.29 .Columns("C:C").ColumnWidth = 4.57 .Columns("C:C").HorizontalAlignment = xlCenter .Columns("D:D").ColumnWidth = 15.57 .Columns("E:E").ColumnWidth = 4 .Columns("F:F").ColumnWidth = 14 .Columns("G:G").ColumnWidth = 15 .Columns("G:G").HorizontalAlignment = xlCenter .Columns("G:G").NumberFormat = "[$-F800]dddd, mmmm dd, yyyy" End With End Sub
Souriane
Partager