Bonjour à tous,
J'ai un problème avec une macro que j'aimerai ajouter à un fichier Excel.
Ce fichier Excel provient d'une extraction trackwise.
Une fois le classeur excel enregistré, j'ajoute ma macro suivante pour la mise en forme:
j'ai plusieurs question:
1) Y a-t-il un code plus simple pour faire ce que je veux faire:
2) Je vous mets le classeur en PJ car quand je veux l'enregistrer, ca me sort un message d'erreur:
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 Sub Macro1() Columns("N:N").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Columns("N:N").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Columns("A:A").ColumnWidth = 7.29 Columns("B:B").ColumnWidth = 15.29 Columns("C:C").ColumnWidth = 20.86 Columns("D:D").ColumnWidth = 11 Columns("E:E").ColumnWidth = 34.43 Columns("F:F").ColumnWidth = 11.14 Columns("G:G").ColumnWidth = 13.86 Columns("H:H").ColumnWidth = 11.14 Columns("I:I").ColumnWidth = 7.43 Columns("J:J").ColumnWidth = 12.43 Columns("K:K").ColumnWidth = 4.86 Columns("L:L").ColumnWidth = 23.71 Columns("M:M").ColumnWidth = 30.57 Columns("N:N").ColumnWidth = 25.86 Columns("O:O").ColumnWidth = 11 Columns("P:P").ColumnWidth = 5 Columns("Q:Q").ColumnWidth = 7.14 Columns("R:R").ColumnWidth = 6.43 Columns("S:S").ColumnWidth = 6 Columns("T:T").ColumnWidth = 11.57 Columns("U:U").ColumnWidth = 11.86 Columns("V:V").ColumnWidth = 11 Columns("W:W").ColumnWidth = 17.57 Columns("X:X").ColumnWidth = 13 Columns("Y:Y").ColumnWidth = 19.29 Columns("Z:Z").ColumnWidth = 30.14 Range("A1:Z1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorAccent1 .TintAndShade = 0.799981688894314 .PatternTintAndShade = 0 End With Range("A1:Z1").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .ColorIndex = 0 .TintAndShade = 0 .Weight = xlThin End With Rows("2:989").Select Selection.RowHeight = 18 Range("A1").Select End Sub
les fonctionnalités suivantes ne peuvent être enregistrées :
macro VB
etc...
Je vous laisse voir par vous même alors que j'enregistre en tant que classeur excel donc 2010 mais ya une fonctionnalité classeur excel prenant en charge les macros . Or avant, que ce soit classeur excel tout cours ou l'autre, je pouvais enregistrer sans aucun problème... Savez vous pourquoi et si oui comment faire pour que ce message n'apparaisse plus svp??
3) Est-il possible d'ajouter ma macro automatiquement au classeur excel ouvert une fois l'extraction de trackwise terminée? Sachant que ce classeur s'ouvre mais n'est enregistré nul part encore.
Merci d'avance pour votre aide.
Bonne journée à tous
Partager