ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VBA Sum Function?? (https://www.excelbanter.com/excel-worksheet-functions/43359-vba-sum-function.html)

Coolboy55

VBA Sum Function??
 

Is there a simple sum function in VBA? I want to add the contents of
several cells together without using a loop or a cheap "=SUM(...)"
assigned string value. Does it exist?


--
Coolboy55
------------------------------------------------------------------------
Coolboy55's Profile: http://www.excelforum.com/member.php...o&userid=26508
View this thread: http://www.excelforum.com/showthread...hreadid=400896


Dave Peterson

You could use +

with activesheet
msgbox .range("a1").value + .range("b1").value + .range("c1").value
end with

But I'd use that cheap that application.sum.

with activesheet
msgbox application.sum(.range("a1:c1"))
end with

Coolboy55 wrote:

Is there a simple sum function in VBA? I want to add the contents of
several cells together without using a loop or a cheap "=SUM(...)"
assigned string value. Does it exist?

--
Coolboy55
------------------------------------------------------------------------
Coolboy55's Profile: http://www.excelforum.com/member.php...o&userid=26508
View this thread: http://www.excelforum.com/showthread...hreadid=400896


--

Dave Peterson

Coolboy55


That doesn't seem to work. The number coming up isn't the total.
Anyone have any other suggestions on how to sum a few cells together
without a loop?


--
Coolboy55
------------------------------------------------------------------------
Coolboy55's Profile: http://www.excelforum.com/member.php...o&userid=26508
View this thread: http://www.excelforum.com/showthread...hreadid=400896


Coolboy55


Never mind, it worked fine. My apologies. :)


--
Coolboy55
------------------------------------------------------------------------
Coolboy55's Profile: http://www.excelforum.com/member.php...o&userid=26508
View this thread: http://www.excelforum.com/showthread...hreadid=400896



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com