Bonjour,
Je souhaite automatiser la mise en forme quotidienne d'un fichier Excel.
J'ai enregistrer un macro en mode manuelle ce qui me donne le code ci-dessou. Seulement dès les premières lignes j'ai une erreur pour 'Merci pour vos remarques!
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 Rows("1:1").Select! Private Sub CommandButton2_Click() Sheets("tblTemp").Select Sheets("tblTemp").Name = "CS1" Sheets("CS1").Select Rows("1:1").Select With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With Selection.Font.ColorIndex = 3 Selection.Font.Bold = True Columns("A:E").Select Selection.EntireColumn.Hidden = True Columns("G:G").Select Selection.EntireColumn.Hidden = True Range("N1").Select ActiveCell.FormulaR1C1 = "Commentaires" Range("O1").Select ActiveCell.FormulaR1C1 = "Annexes" Rows("2:2").Select Range("F2").Activate ActiveWindow.FreezePanes = True Range("F1:O170").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlCenter .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Rows("1:1").Select Range("F1").Activate Selection.AutoFilter Sheets("Accueil").Select End Sub
Partager