A
alain121
Guest
bonjour,
svp je suis un débutant en vba ,s'il ya une possibilité de m'aider a resoudre ce probléme dans vba.😕😕
j'Ecrit le programme suivant mais il ne marche pas et j'ai pas trouvé sa solution il me sort une erreur d’exécution:
Public Function calculerA(ByVal deq As Double) As Double
Dim a As Double
Dim Harray(8) As Double
Dim Barray(8) As Double
Dim Earray(8) As Double
Dim varray(8) As Double
Dim l2, l1, ni, bi As Variant
Dim n As Integer
Dim i As Integer
Set Harray = Worksheets("Sheet22").Range("D10:K10").Value
Set Barray = Worksheets("Sheet 22").Range("D13:K13").Value
Set Earray = Worksheets("Sheet4").Range("D18:K18").Value
Set varray = Worksheets("Sheet4").Range("D19:K19").Value
Set n = Range("h13").Value
For Each n In Harray
Set ni = Harray(i) / deq
l1 = -8.32066761630003E-05 * ni ^ 10 + 2.83728990163457E-03 * ni ^ 9 + -4.17149086514715E-02 * ni ^ 8 + 0.345488144703355 * ni ^ 7 + -1.76614131826504 * ni ^ 6 + 5.73604534522509 * ni ^ 5 + -11.7120105665989 * ni ^ 4 + 14.233053963565 * ni ^ 3 - 8.84767430958517 * ni ^ 2 + 1.31869491144441 * ni + 0.976119034393375
Harray(i) = l1(i)
Next i
For Each b In Barray
Set bi = Barray(i) / deq
l2 = -8.32066761630003E-05 * bi ^ 10 + 2.83728990163457E-03 * bi ^ 9 + -4.17149086514715E-02 * bi ^ 8 + 0.345488144703355 * bi ^ 7 + -1.76614131826504 * bi ^ 6 + 5.73604534522509 * bi ^ 5 + -11.7120105665989 * bi ^ 4 + 14.233053963565 * bi ^ 3 - 8.84767430958517 * bi ^ 2 + 1.31869491144441 * bi + 0.976119034393375
Barray(i) = l2(i)
Next i
a = 0
For i = 1 To n
Application.Goto Reference:="calculer"
a = a + (l1(i) - l2(i)) * (1 - varray(i) ^ 2) / Earray(i)
Next i
Exit For
End Function
Public Function calculerB(ByVal deq As Double) As Double
Dim b As Variant
Dim e As Double
Dim h As Double
Set h = Worksheets("Sheet2").Range("D10").Value
Set e = Worksheets("Sheet10").Range("D6").Value
b = (deq / h) ^ 3 / (6.7392 * e)
End Function
Sub Macro5()
Dim a As Variant
Dim b As Variant
Dim n As Range
Dim h As Range
Dim eb As Range
Dim Es As Range
Dim deq As Variant
eb = ActiveWorkbook.Sheets("calcul de déformation").Range("D6").Value
Es = ActiveWorkbook.Sheets("définition des couches").Range("D18").Value
n = ActiveWorkbook.Sheets("définition des couches").Range("h13").Value
h = ActiveWorkbook.Sheets("paramètre généraux").Range("D10").Value
If n > 1 Then
deq = 0
With a <> b
a = calculerA(deq)
b = calculerB(deq)
deq = deq + 1
End With
Else
deq = 1.97 * h * (eb / Es) ^ 1 / 3
End If
Range("d17") = deq
End Sub
merci d'avance.
svp je suis un débutant en vba ,s'il ya une possibilité de m'aider a resoudre ce probléme dans vba.😕😕
j'Ecrit le programme suivant mais il ne marche pas et j'ai pas trouvé sa solution il me sort une erreur d’exécution:
Public Function calculerA(ByVal deq As Double) As Double
Dim a As Double
Dim Harray(8) As Double
Dim Barray(8) As Double
Dim Earray(8) As Double
Dim varray(8) As Double
Dim l2, l1, ni, bi As Variant
Dim n As Integer
Dim i As Integer
Set Harray = Worksheets("Sheet22").Range("D10:K10").Value
Set Barray = Worksheets("Sheet 22").Range("D13:K13").Value
Set Earray = Worksheets("Sheet4").Range("D18:K18").Value
Set varray = Worksheets("Sheet4").Range("D19:K19").Value
Set n = Range("h13").Value
For Each n In Harray
Set ni = Harray(i) / deq
l1 = -8.32066761630003E-05 * ni ^ 10 + 2.83728990163457E-03 * ni ^ 9 + -4.17149086514715E-02 * ni ^ 8 + 0.345488144703355 * ni ^ 7 + -1.76614131826504 * ni ^ 6 + 5.73604534522509 * ni ^ 5 + -11.7120105665989 * ni ^ 4 + 14.233053963565 * ni ^ 3 - 8.84767430958517 * ni ^ 2 + 1.31869491144441 * ni + 0.976119034393375
Harray(i) = l1(i)
Next i
For Each b In Barray
Set bi = Barray(i) / deq
l2 = -8.32066761630003E-05 * bi ^ 10 + 2.83728990163457E-03 * bi ^ 9 + -4.17149086514715E-02 * bi ^ 8 + 0.345488144703355 * bi ^ 7 + -1.76614131826504 * bi ^ 6 + 5.73604534522509 * bi ^ 5 + -11.7120105665989 * bi ^ 4 + 14.233053963565 * bi ^ 3 - 8.84767430958517 * bi ^ 2 + 1.31869491144441 * bi + 0.976119034393375
Barray(i) = l2(i)
Next i
a = 0
For i = 1 To n
Application.Goto Reference:="calculer"
a = a + (l1(i) - l2(i)) * (1 - varray(i) ^ 2) / Earray(i)
Next i
Exit For
End Function
Public Function calculerB(ByVal deq As Double) As Double
Dim b As Variant
Dim e As Double
Dim h As Double
Set h = Worksheets("Sheet2").Range("D10").Value
Set e = Worksheets("Sheet10").Range("D6").Value
b = (deq / h) ^ 3 / (6.7392 * e)
End Function
Sub Macro5()
Dim a As Variant
Dim b As Variant
Dim n As Range
Dim h As Range
Dim eb As Range
Dim Es As Range
Dim deq As Variant
eb = ActiveWorkbook.Sheets("calcul de déformation").Range("D6").Value
Es = ActiveWorkbook.Sheets("définition des couches").Range("D18").Value
n = ActiveWorkbook.Sheets("définition des couches").Range("h13").Value
h = ActiveWorkbook.Sheets("paramètre généraux").Range("D10").Value
If n > 1 Then
deq = 0
With a <> b
a = calculerA(deq)
b = calculerB(deq)
deq = deq + 1
End With
Else
deq = 1.97 * h * (eb / Es) ^ 1 / 3
End If
Range("d17") = deq
End Sub
merci d'avance.