View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dna1711 dna1711 is offline
external usenet poster
 
Posts: 5
Default Variable inside function range

Hi all,

I have an averaging macro working with the following line in it:
ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-1]:R[9]C[-1])"
the line averages 10 rows of data in the same column. What I want to do is
change the "9" to a variable that I use elsewhere in the macro (boxsize) so
that the number of averaged cells changes automatically. But when I
substitute the variable (boxsize, which = 9) into the line above, I get an
error. Could someone please tell me why it doesn't work and what can I do to
fix it.

Thanks,