#1   Report Post  
Posted to microsoft.public.excel.programming
tj tj is offline
external usenet poster
 
Posts: 6
Default Formula

Does anyone know the vba code to show a summation in an
excel formula as =SUM(A1,A2,A3,A4) --- the only ones I
know show up as =SUM(A1:A4)





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula

the VBA code is exactly as you wrote it.

But, as long as you are in VBA, why would you want to do it that way?

Why not:

Total = 0
For i = 1 to 4
Total = Total + cells(i, "A")
Next

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 733
Default Formula

"MSP77079 " wrote...
the VBA code is exactly as you wrote it.

But, as long as you are in VBA, why would you want to do it that way?

Why not:

Total = 0
For i = 1 to 4
Total = Total + cells(i, "A")
Next i


Perhaps either

Total = Evaluate("SUM(A1:A4)")

or

Total = Application.WorksheetFunction.Sum(Range("A1:A4"))

run more quickly than your For loop.


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
Commenting custom formula fields/formula on formula editor Muxer Excel Programming 2 July 24th 03 01:02 AM


All times are GMT +1. The time now is 08:12 AM.

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

About Us

"It's about Microsoft Excel"