I want to find the average of some set of values.
I am doing this:
Dim avg(1 To 14)
For i = 1 To 14
Dim helparray(1 To 3)
For j = 1 To 3
helparray(j) = Sheets("mysheet").Cells(i, j)
Next j
Avg(i) = Application.Average(helparray)
Erase helparray
Next i
What happens with the declaration of helparray? Is it be redeclared on every iteration? Or is it only cleaned?
How do I create a NEW array on every iteration (and then delete it)?
Erase) after each iteration.Dim avg as Variantto declare a variant. And thenavg = Range("A1:C14").valueto put the values from the range into the array.