Thread: Summing rows
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeff Garrett Jeff Garrett is offline
external usenet poster
 
Posts: 3
Default Summing rows

I want to sum the integer elements from row 2 to row 9 inclusive, then
display it in a cell a couple rows below the last element, say row 14.
The trick though, is I am iterating through each column in the worksheet.

Sub SortEachColumn()
Range("A14") = "Best 8 Marks"
Range("A15") = "Total Possible"
Range("A16") = "Total Mark"
lc = cells(2, "iv").End(xlToLeft).Column
For i = 2 To lc
lr = cells(Rows.Count, i).End(xlUp).Row
Next i
End Sub

Notice in line 6, where it goes to the end (End(xlUp)), that is too far. I
only want from row 2 to row 9 inclusive, and then display the sum in row 14
of that column