View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default How to set up macros that will work when aditional data is added

A macro works the same as a worksheet function. SAuppose you have a range
from A1:A10 and you put in cell A11 the formula "=sum(A1:A10)". Adding a row
at row number 5 will change the formula now at A12 to "=Sum(A1:A11"). The
problem is if you add the new row at row number 11 the formula will move to
A12 but the formula will remain at "=sum(A1:A10)".

What I usually will do is add a new row at row 10. This will move the
fromula to A12 and update the formula to "=Sum(A1:A11"). The problem is the
data at A10 is at A11 and the cell A10 is empty. I then copy A11 to A10 and
then put the new data at A11 to put the new data after the old data.

The same thing applies if you are adding multiple rows.

"John" wrote:

I want to write macros that will automatically update the spreadsheet when I
add further data. For example I have 10 columns x 8 rows of dat and write a
macro to generate average and standard error of the mean in the cells below
each column. Later, when I get the results from the next set of experiments
I insert a further 8 rows of data giving me 16 rows in all. Is it possible
to construct a macro that will handle this or do I just have to insert the
formula again this time for 16 rows?

This may sound trivial but we have lots of data accross many different
experiments and it would be more elegant and efficient if I could produce a
spreadsheet that our students could just paste their results into that would
do the necessary calculations for them.
--
medjpb