It depends on what your needs are. The first,
activecell.Formula="=sum(a1:a5)"
will insert a formula, so its result will change as the values in
A1:A5 changs.
The second,
activecell=worksheetfunction.Sum(range("a1:a5"))
will return a number which will not changes as the values in
A1:A5 change, unless of course you re-run the code.
Without further detail, I would likely use the first approach.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"R..VENKATARAMAN" wrote in message
...
among these two code statements which is better
activecell.Formula="=sum(a1:a5)"
activecell=worksheetfunction.Sum(range("a1:a5"))