Bonjour à tous!
J'ai un problème relativement simple sur une macro faites avec l'aide de Visual Basic Editeur.
Voici mon code:
Lors de l'execution de ce code, un message d'erreur apparait. Il dit: "Dépassement de capacités" et il a un 6 entre guillement... hé oui, je suis une quiche en informatique...
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 Dim ani(1 To 1233) As Byte Dim cor(1 To 1233) As Byte Dim lik(1 To 1233) As Byte Dim somme(1 To 12) As Byte ' somme des douzes Licks Dim l As Byte Sub AFFECTE() ' execution Call LECTURE Call CONDITION Call ECRITURE End Sub Sub LECTURE() For l = 1 To 1233 ani(l) = Cells(l + 1, 3).Value cor(l) = Cells(l + 1, 5).Value lik(l) = Cells(l + 1, 12).Value Next l End Sub Sub CONDITION() ' calcul la somme des Licks d'animal et de corner For l = 1 To 1233 ' calcul d animal zero et de corner un If (ani(l) = 0) Then If (cor(l) = 1) Then somme(1) = somme(1) + lik(l) End If End If ' calcul d animal zero et de corner deux If (ani(l) = 0) Then If (cor(l) = 2) Then somme(2) = somme(2) + lik(l) End If End If ' calcul d animal zero et de corner trois If (ani(l) = 0) Then If (cor(l) = 3) Then somme(3) = somme(3) + lik(l) End If End If ' calcul d animal zero et de corner quatre If (ani(l) = 0) Then If (cor(l) = 4) Then somme(4) = somme(4) + lik(l) End If End If ' calcul d animal un et de corner un If (ani(l) = 1) Then If (cor(l) = 1) Then somme(5) = somme(5) + lik(l) End If End If ' calcul d animal un et de corner deux If (ani(l) = 1) Then If (cor(l) = 2) Then somme(6) = somme(6) + lik(l) End If End If ' calcul d animal un et de corner trois If (ani(l) = 1) Then If (cor(l) = 3) Then somme(7) = somme(7) + lik(l) End If End If ' calcul d animal un et de corner quatre If (ani(l) = 1) Then If (cor(l) = 4) Then somme(8) = somme(8) + lik(l) End If End If ' calcul d animal deux et de corner un If (ani(l) = 2) Then If (cor(l) = 1) Then somme(9) = somme(9) + lik(l) End If End If ' calcul d animal deux et de corner deux If (ani(l) = 2) Then If (cor(l) = 2) Then somme(10) = somme(10) + lik(l) End If End If ' calcul d animal deux et de corner trois If (ani(l) = 2) Then If (cor(l) = 3) Then somme(11) = somme(11) + lik(l) End If End If ' calcul d animal deux et de corner quatre If (ani(l) = 2) Then If (cor(l) = 4) Then somme(12) = somme(12) + lik(l) End If End If Next l End Sub Sub ECRITURE() For l = 1 To 12 Cells(l + 1, 15).Value = somme(l) Next l End Sub
Merci de m'aider!![]()
Partager