Bonjour à tous,

j'ai un problème avec la macro que j'essaie de 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
 
Sub Notation()
 
Dim min As Integer, max As Integer
Dim PE(1), EE(0), SE(1)
Dim PA(0), EA(1), SA(1)
Dim i As Integer
 
Worksheets("Feuil1").Activate
 
min = 2
max = 9
 
EE(0) = "B"
PE(0) = "C"
PE(1) = "d"
SE(0) = "E"
 
SA(0) = "f"
EA(0) = "g"
PA(0) = "h"
EA(1) = "i"
 
SE(1) = "j"
SA(1) = "j"
 
'Debug.Print Note(i, PE())
 
For i = min To max
    If Range("a" & i) = "Eau" Then
        Range("k" & i).Value = Note(i, PE())
        Range("l" & i).Value = Note(i, EE())
        Range("m" & i).Value = Note(i, SE())
    ElseIf Cells(i, "a") = "Ass" Then
        Range("k" & i).Value = Note(i, PA())
        Range("l" & i).Value = Note(i, EA())
        Range("m" & i).Value = Note(i, SA())
Next
 
End Sub
____________________________________________________
Function Note(lg As Integer, ParamArray Rng() As Variant) As Long
 
Dim i As Integer, j As Integer, n As Integer
Dim alpha, pi
Dim A, Am
 
'calcul du nombre de cellules
n = UBound(Rng) + 1
 
'calcul de l'angle
pi = 4 * Atn(1)
alpha = 2 * pi / n
 
Debug.Print n
 
'définition de ma matrice M
Dim M()
ReDim M(n - 1, n - 1)
 
For i = 0 To n - 1
    For j = 0 To n - 1
        M(i, j) = 0
    Next
Next
 
M(n - 1, 0) = 1
 
For i = 0 To n - 2
    M(i, i + 1) = 1
Next
 
'definition du vecteur X
Dim X()
ReDim X(n - 1, 0)
 
For i = 0 To n - 1
    X(i, 0) = ActiveSheet.Cells(lg, Rng(i).Value)
Next
 
'création de la tranposé de X
Dim TX()
Call Tvect(X, TX)
 
'quelques petits calculs
Dim p1(), p2()
 
Call PMAT(M(), X(), p1())
Call PMAT(TX(), p1(), p2())
 
A = 1 / 2 * Sin(alpha) * p2(0, 0)
Am = 1 / 2 * Sin(alpha) * 100 ^ 2 * n
 
Note = A / Am
 
End Function
_______________________________________
Sub PMAT(A(), B(), C())
 
'calcule le produit des matrices A*B et le met dans la matrice C
 
Dim i As Integer, j As Integer, k As Integer
Dim n As Integer, M As Integer, p As Integer
 
n = UBound(A, 2)
M = UBound(A, 1)
p = UBound(B, 2)
 
ReDim C(M, p)
 
For i = 0 To M
    For j = 0 To p
        For k = 0 To n
            C(i, j) = C(i, j) + A(i, k) * B(k, j)
        Next
    Next
Next
 
End Sub
_________________________________________
Sub Tvect(X(), TX())
 
'calcule le vecteur transposé de X
 
Dim i As Integer, n As Integer
 
n = UBound(X, 1)
 
ReDim TX(0, n)
 
For i = 0 To n
    TX(0, i) = X(i, 0)
Next
 
End Sub
voici ce que çà me donne:

"Erreur de compilation : variable ou procédure attendue, et non un module"
en la première occurence de le fonction "Note" est surlignée dans la procédure "Notation"
est-ce que quelqu'un voit le problème ????