Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something like:
Sub sumColumn() Dim firstRow As Long Dim lastRow As Long Dim aColumn As Integer aColumn = 7 'Column G firstRow = 9 lastRow = Cells(65536, aColumn).End(xlUp).Row If lastRow = firstRow Then _ Cells(lastRow + 1, aColumn) = _ "=SUM(R" & firstRow & "C:R" & lastRow & "C)" End Sub This assumes that there is no total already entered (or else the existing total would be included in the new total). Tim -----Original Message----- I would like to sum a column in a macro I have recorded. It would start at the same cell (G9) everytime but the length of the column will vary from day to day. I would like to put the sum in the first available cell at the end of the column. What would be the best way to accomplish this. Thank you in advance. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Summing a column | Excel Worksheet Functions | |||
summing column c based an column a criteria | Excel Worksheet Functions | |||
Summing a Column instead of a Column range | Excel Discussion (Misc queries) | |||
Summing one column based on date in another column | New Users to Excel | |||
Summing a column | Excel Worksheet Functions |