Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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=542068 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will work, its set up to look in column C, from Row 6 to find a empty
cell. Once an empty cell is found it will put in your autosum for that range. If you need further assistance I can send you an example workbook Sub Macro1() Dim LastRow LastRow = Sheet1.UsedRange.Row + 1 _ + Sheet1.UsedRange.Rows.Count For x = 6 To LastRow If Sheet1.Cells(x, 3).Value = "" Then Range("C" & x).FormulaR1C1 = "=SUM(R[-" & x - 1 & "]C:R[-1]C)" Exit For End If Next End Sub -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
When is a cell empty and how do I empty it. | Excel Discussion (Misc queries) | |||
Leaving an empty cell empty | Excel Discussion (Misc queries) | |||
why a reference to an empty cell is not considered empty | Excel Discussion (Misc queries) | |||
Finding next empty empty cell in a range of columns | Excel Programming | |||
Empty cell and a the empty String | Excel Programming |