I use LabView software and when I run a test in the lab, all the data is dumped into excel through a macro that organizes it. Usually I have rows of data and the macro, at the end, computes the average of the last 10 values per column. However, the problem is that if there isn't 10 rows of data, it spits out an error. What I want is for it to still compute the average even if there are 9 or less values(rows). Any help is appreciated.
This is what I have so far. Like I said, it computes the average of the last 10 values per column:
'Start of Average Macro
Cells.Find(What:="timestamp", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
ActiveCell.Offset(0, 1).Select
Selection.End(xlDown).Select
Do
Selection.Range("A3").Select
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-11]C:R[-2]C)"
ActiveCell.Offset(-2, 1).Select
Loop While Abs(ActiveCell) > 0.05