Bonjour à tous et à toutes,
je suis débutant dans le monde de VBA(j'y connais pas grand chose) et nouveau sur ce forum,
je souhaiterai soliciter votre aide. Je cherche à calculer le facteur de rayonnement d'une paroi en fonction de la fréquence d'excitation mais voilà j'ai un soucis dans mon programme que voici:
quand j'execute le programme le message suivant apparait :
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 Const pi As Single = 3.14 Const c0 As Integer = 343 Const rho As Single = 1.21 Function sigma(f As Variant) As Variant End Function Public Sub rayonnement() Dim fc As Single Dim f11 As Single Dim sigma2 As Single Dim sigma3 As Single Dim Y As Variant Dim delta1 As Variant Dim delta2 As Variant Dim L1 As Integer Dim L2 As Integer L1 = 5 L2 = 3 fc = 111.65 f11 = ((c0 ^ 2) / (4 * fc)) * ((1 / (L1 ^ 2)) + (1 / (L2 ^ 2))) Dim J As Integer J= 0 For Each f In Range("Feuil1!B5:B25") '<< A Ajuster à ta plage ... sigma2 = 4 * L1 * L2 * ((f / c0) ^ 2) sigma3 = Sqr((2 * pi * f * (L1 + L2)) / (16 * c0)) Y = Sqr(f / fc) If f11 <= (fc / 2) And f > fc Then ' => SI condition 1 validée ALORS sigma(f) = 1 / Sqr(1 - (fc / f)) ElseIf f11 <= (fc / 2) And f < fc And f > (fc / 2) Then ' => SINON, SI condition 2 validée ALORS delta1 = ((1 - (Y ^ 2)) * Log(((1 + Y) / (1 - Y)) + (2 * Y))) / (4 * ((pi) ^ 2) * ((1 - (Y ^ 2)) ^ (1.5))) delta2 = 0 sigma(f) = (((2 * (L1 + L2) / (L1 * L2)) * (c0 / fc)) * delta1) + delta2 ElseIf f11 <= (fc / 2) And f < (fc / 2) Then '=> SINON delta1 = ((1 - (Y ^ 2)) * Log(((1 + Y) / (1 - Y)) + (2 * Y))) / (4 * ((pi) ^ 2) * ((1 - (Y ^ 2)) ^ (1.5))) delta2 = (8 * (c0 ^ 2) * (1 - (2 * (Y ^ 2)))) / ((fc ^ 2) * (pi ^ 4) * L1 * L2 * Y * Sqr(1 - (Y ^ 2))) sigma(f) = (((2 * (L1 + L2) / (L1 * L2)) * (c0 / fc)) * delta1) + delta2 ElseIf f11 < (fc / 2) And f < f11 And sigma(f) > sigma2 Then sigma(f) = sigma2 ElseIf f11 > (fc / 2) And f < fc And sigma2 < sigma3 Then sigma(f) = sigma2 ElseIf f11 > (fc / 2) And f > fc And (1 / Sqr(1 - (fc / f))) < sigma3 Then sigma(f) = 1 / Sqr(1 - (fc / f)) ElseIf f11 > (fc / 2) And f > fc And (1 / Sqr(1 - (fc / f))) > sigma3 Then sigma(f) = sigma3 End If J = J + 1 Sheets("Feuil3").Cells(J, 3).Value = sigma(f) Next End Subpour les lignes en gras et en italiques .erreur d'execution 424 objet requis
Merci pour votre aide.
Partager