back to wind data !!
if i want to average a series of wind speeds, then i can write something like this:
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-1]C[-2]:R[31833]C[-2])
which averages the numbers in whichever column i happen to select relative to the activecell.
however, the ranges i'm dealing with change length. some arrays have 31833 rows in (as above) however others have twice that.
i've been learning something in the last week as i can now set a variable which can hold the number of rows that is in an usedrange. my promlem is that i'm having trouble writing the correct code to do the above average but using a variable instead of a number.
this is what i have tried, but none work
ActiveCell.FormulaR1C1 = "=AVERAGE(R[-2]C[-19]:R[CStr (i)]C[-19])
where i is the variable.
could anyone kindly suggest the correct way of writing this in VBA
mark