Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default use of activecell.formula

among these two code statements which is better

activecell.Formula="=sum(a1:a5)"
activecell=worksheetfunction.Sum(range("a1:a5"))



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default use of activecell.formula

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"))





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default use of activecell.formula

thank you Mr. Pearson.


"Chip Pearson" wrote in message
...
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"))







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
ActiveCell.Formula Help Srikanth Ganesan[_2_] Excel Programming 1 September 2nd 04 10:38 PM
ActiveCell.Formula Matt P.[_2_] Excel Programming 2 August 29th 04 08:14 PM
activecell.formula syntax Larry Levinson Excel Programming 4 December 23rd 03 01:33 PM
Formula with an ActiveCell Sok Hong Excel Programming 3 August 14th 03 08:24 AM


All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"