ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Summing until empty cell (https://www.excelbanter.com/excel-programming/361480-summing-until-empty-cell.html)

Hru48[_19_]

Summing until empty cell
 

Hey,

I need a statement for a macro that will sum all the numbers in a range
say d7:d20 and stop when it hits the empty cell below. as I have a gap
and then some more numbers which I don't want included. I also don't
know what the range will be from month to month i.e. next month it
could be d7:d5 etc..

I'm thinking I could put the sum formula at the top and then say do
until active cell = "" but i'm really not sure..

cheers for any help

Hayley


--
Hru48
------------------------------------------------------------------------
Hru48's Profile: http://www.excelforum.com/member.php...o&userid=24895
View this thread: http://www.excelforum.com/showthread...hreadid=542072


Bob Phillips[_14_]

Summing until empty cell
 

iLastRow = Range("D7").End(xlDown)
myVar = Application.SUM(Range("D7:D" & iLastRow))


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Hru48" wrote in
message ...

Hey,

I need a statement for a macro that will sum all the numbers in a range
say d7:d20 and stop when it hits the empty cell below. as I have a gap
and then some more numbers which I don't want included. I also don't
know what the range will be from month to month i.e. next month it
could be d7:d5 etc..

I'm thinking I could put the sum formula at the top and then say do
until active cell = "" but i'm really not sure..

cheers for any help

Hayley


--
Hru48
------------------------------------------------------------------------
Hru48's Profile:

http://www.excelforum.com/member.php...o&userid=24895
View this thread: http://www.excelforum.com/showthread...hreadid=542072





All times are GMT +1. The time now is 06:19 AM.

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