Sub Test2()
Dim o&, IndA&, tab_calcul(), i&, aux(), n&, SMA5
o = 1
IndA = 4
ReDim tab_calcul(o + IndA, 16)
tab_calcul(o, 16) = 100
tab_calcul(o + 1, 16) = 200
tab_calcul(o + 2, 16) = 300
tab_calcul(o + 3, 16) = 400
tab_calcul(o + 4, 16) = Empty '"aaa"
For i = LBound(tab_calcul, 1) To UBound(tab_calcul, 1)
If IsNumeric(tab_calcul(i, 16)) Then
ReDim Preserve aux(n) 'tableau auxiliaire base 0
aux(n) = tab_calcul(i, 16)
n = n + 1
End If
Next
SMA5 = Application.WorksheetFunction.Average(aux)
MsgBox SMA5
End Sub