Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
sum range of cells using cells, not range
I'm trying to sum part of columns by looping - I'm struggling to find
a way to sum the range using the cells reference, not range: finalrow = Range("A65000").End(xlUp).Row totalRow = 0 startRow = 2 currentCol = 4 Do Until totalRow = finalrow totalRow = totalRow + 1 lastRow = totalRow - 1 If currentCol < 21 Then If Cells(totalRow, 21).Value = "" Then problem --- Cells(totalRow, 4).Value = Application.WorksheetFunction.Sum(Cells(lastRow, currentCol), Cells(startRow, currentCol)) currentCol = currentCol + 1 End If End If Loop |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
sum range of cells using cells, not range
Application.WorksheetFunction.Sum(Range(Cells(last Row,
currentCol),Cells(startRow, currentCol))) -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message ups.com... I'm trying to sum part of columns by looping - I'm struggling to find a way to sum the range using the cells reference, not range: finalrow = Range("A65000").End(xlUp).Row totalRow = 0 startRow = 2 currentCol = 4 Do Until totalRow = finalrow totalRow = totalRow + 1 lastRow = totalRow - 1 If currentCol < 21 Then If Cells(totalRow, 21).Value = "" Then problem --- Cells(totalRow, 4).Value = Application.WorksheetFunction.Sum(Cells(lastRow, currentCol), Cells(startRow, currentCol)) currentCol = currentCol + 1 End If End If Loop |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
sum range of cells using cells, not range
And lastRow is zero the first time thru the loop. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
sum range of cells using cells, not range
On Mar 27, 6:10 pm, "Bob Phillips" wrote:
Application.WorksheetFunction.Sum(Range(Cells(last Row, currentCol),Cells(startRow, currentCol))) -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message ups.com... I'm trying tosumpart of columns by looping - I'm struggling to find a way tosumtherangeusingthecellsreference,notrange: finalrow =Range("A65000").End(xlUp).Row totalRow = 0 startRow = 2 currentCol = 4 Do Until totalRow = finalrow totalRow = totalRow + 1 lastRow = totalRow - 1 If currentCol < 21 Then IfCells(totalRow, 21).Value = "" Then problem --- Cells(totalRow, 4).Value = Application.WorksheetFunction.Sum(Cells(lastRow, currentCol), Cells(startRow, currentCol)) currentCol = currentCol + 1 End If End If Loop- Hide quoted text - - Show quoted text - Bob, Thanks - that worked perfect!! Richard |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
sum range of cells using cells, not range
On Mar 27, 6:10 pm, "Bob Phillips" wrote:
Application.WorksheetFunction.Sum(Range(Cells(last Row, currentCol),Cells(startRow, currentCol))) -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) wrote in message ups.com... I'm trying tosumpart of columns by looping - I'm struggling to find a way tosumtherangeusingthecellsreference,notrange: finalrow =Range("A65000").End(xlUp).Row totalRow = 0 startRow = 2 currentCol = 4 Do Until totalRow = finalrow totalRow = totalRow + 1 lastRow = totalRow - 1 If currentCol < 21 Then IfCells(totalRow, 21).Value = "" Then problem --- Cells(totalRow, 4).Value = Application.WorksheetFunction.Sum(Cells(lastRow, currentCol), Cells(startRow, currentCol)) currentCol = currentCol + 1 End If End If Loop- Hide quoted text - - Show quoted text - Bob, Thanks - that worked perfect!! Richard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
When entering data into a range of cells, select the entire range. | Excel Discussion (Misc queries) | |||
how to compute a range of cells based on another range of cells? | Excel Worksheet Functions | |||
how to compute a range of cells based on another range of cells? | Excel Worksheet Functions | |||
Compare a selected Range with a Named range and select cells that do not exist | Excel Programming | |||
Copy a formula to a range of cells via VB6 using .Range(Cells(row,col), Cells(row,col)).Formula= statement | Excel Programming |