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
|
Sub calCoeff()
Dim i As Integer
Dim DerLig As Long
With Worksheets("Moyenne_Mobile")
DerLig = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To DerLig
.Cells(i, 3).Value = Application.WorksheetFunction.Average(.Cells(i, 2).Value, _
.Cells(i + 1, 2).Value, _
.Cells(i + 2, 2).Value, _
.Cells(i + 3, 2).Value)
.Cells(i, 4).Value = Application.WorksheetFunction.Average(0.5 * .Cells(i, 2).Value, _
.Cells(i + 1, 2).Value, _
.Cells(i + 2, 2).Value + _
.Cells(i + 3, 2).Value, _
0.5 * .Cells(i + 4, 2).Value)
Next i
End With
End Sub |
Partager