Bonjour à tous ,
Je suis un débutant en VBA et je doit écrire une Macro qui me permet d’automatiser ce que j’ai l’abitude de faire avec les clic manuels. Voila mon problème.Je dois écrire un programe qui me permet de classer un fichier Excel en fonction des variables que contient le fichier et les différent projets dans lesquel les variables sont utilisées.
J'ai joint à ce problème un fichier Excel dans lequel la 1ere feuille est celle en désordre et le seconde feuille est le fichier. Donc j'ai commencé a classer manuellement.
J'ai essayé d'automatiser ce classement avec les Macros mais cela est trop limité et ça fait deja 1mois que je cherche comment faire une application qui va me gérer ce processus mais je n'y arrive vraiment pas.
Voici ce que j'ai déjà pu faire .

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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
Sub Makro1()
'
' Makro1 Makro
 
    Range("B3").Select
    ActiveCell.FormulaR1C1 = "Iv_volt = 4;" & Chr(10) & "Card = 8;" & Chr(10) & "Ampli = 7Hz;"
    With ActiveCell.Characters(Start:=1, Length:=35).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle2").Select
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "Iv_volt"
    Sheets("Tabelle1").Select
    Range("E3").Select
    ActiveCell.FormulaR1C1 = _
        "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
    With ActiveCell.Characters(Start:=1, Length:=58).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle2").Select
    Range("B2").Select
    ActiveCell.FormulaR1C1 = _
        "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
    With ActiveCell.Characters(Start:=1, Length:=58).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle1").Select
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "Sozb1908"
    Sheets("Tabelle2").Select
    Range("C2").Select
    ActiveCell.FormulaR1C1 = "Sozb"
    Sheets("Tabelle1").Select
    Range("B3").Select
    ActiveCell.FormulaR1C1 = "Iv_volt = 4;" & Chr(10) & "Card = 8;" & Chr(10) & "Ampli = 7Hz;"
    With ActiveCell.Characters(Start:=1, Length:=35).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle2").Select
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "Card"
    Sheets("Tabelle1").Select
    Range("E3").Select
    ActiveCell.FormulaR1C1 = _
        "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
    With ActiveCell.Characters(Start:=1, Length:=58).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle2").Select
    Range("B3").Select
    ActiveCell.FormulaR1C1 = _
        "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
    With ActiveCell.Characters(Start:=1, Length:=58).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle1").Select
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "Sozb1908"
    Sheets("Tabelle2").Select
    Range("C3").Select
    ActiveCell.FormulaR1C1 = "Sozb"
    Sheets("Tabelle1").Select
    Range("B3").Select
    ActiveCell.FormulaR1C1 = "Iv_volt = 4;" & Chr(10) & "Card = 8;" & Chr(10) & "Ampli = 7Hz;"
    With ActiveCell.Characters(Start:=1, Length:=35).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle2").Select
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "Ampli "
    Sheets("Tabelle1").Select
    Range("E3").Select
    ActiveCell.FormulaR1C1 = _
        "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
    With ActiveCell.Characters(Start:=1, Length:=58).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle2").Select
    Range("B4").Select
    ActiveCell.FormulaR1C1 = _
        "Hardw.2x" & Chr(10) & "Hadrw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.9.0" & Chr(10) & "Hardw.0.8" & Chr(10) & "Hardw.7.9"
    With ActiveCell.Characters(Start:=1, Length:=58).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle1").Select
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "Sozb1908"
    Sheets("Tabelle2").Select
    Range("C4").Select
    ActiveCell.FormulaR1C1 = "Sozb"
    Sheets("Tabelle1").Select
    Range("B4").Select
    ActiveCell.FormulaR1C1 = _
        "Iv_volt = 2;" & Chr(10) & "Card = 8;" & Chr(10) & "Coptr_v = 1;" & Chr(10) & "Exel_1 =0;" & Chr(10) & "Time = 10S;"
    With ActiveCell.Characters(Start:=1, Length:=58).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle2").Select
    Range("A5").Select
    ActiveCell.FormulaR1C1 = "Coptr_v"
    Sheets("Tabelle1").Select
    Range("E4").Select
    ActiveCell.FormulaR1C1 = "Hardw.2x" & Chr(10) & "Hardw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.2.x"
    With ActiveCell.Characters(Start:=1, Length:=38).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle2").Select
    Range("B5").Select
    ActiveCell.FormulaR1C1 = "Hardw.2x" & Chr(10) & "Hardw.3.8" & Chr(10) & "Hardw.1.2" & Chr(10) & "Hardw.2.x"
    With ActiveCell.Characters(Start:=1, Length:=38).Font
        .Name = "Calibri"
        .FontStyle = "Standard"
        .Size = 11
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ThemeColor = xlThemeColorLight1
        .TintAndShade = 0
        .ThemeFont = xlThemeFontMinor
    End With
    Sheets("Tabelle1").Select
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "Sozb176"
    Sheets("Tabelle2").Select
    Range("A6").Select
    ActiveCell.FormulaR1C1 = ""
    Range("C5").Select
    ActiveCell.FormulaR1C1 = "Sozb"
    Range("D4").Select
    Sheets("Tabelle1").Select
    ActiveWindow.SmallScroll Down:=-21
    Application.WindowState = xlMinimized
End Sub
Merci beaucoup pour votre aide, j'en suis vraiment à bout .
Cordialement Stephane