Calculate the sum of rows using macro
Solved/Closed
Related:
- Which feature is used to calculate the sum of rows and columns, in excel?
- How to insert blank rows using macros in Excel - Guide
- How to calculate the sum of names in excel - Guide
- Calculate the sum of squares of given input of numbers - Forum - Programming
- Macro to insert row in excel based on criteria ✓ - Forum - Excel
- Macro to insert row based on variable cell value (text) - Forum - Excel
1 reply
Excelguru
Jun 3, 2009 at 03:58 AM
- Posts
- 261
- Registration date
- Saturday April 11, 2009
- Status
- Member
- Last seen
- June 21, 2011
Jun 3, 2009 at 03:58 AM
Hi
The problem seems to be in the line Cells(lngLastColumn + 1, lngRow).Formula = "=Sum(" & Cells(1, lngRow).Address & ":" & _
Cells(lngLastColumn, lngRow).Address & ")"
I think , here you have to use Cells(lngRow,lngLastColumn + 1).
My suggestion is to use activesheet.usedrange.rows.count instead of Range.End(xlToRight) and the like statements.
Please revert back if you have any qurties
The problem seems to be in the line Cells(lngLastColumn + 1, lngRow).Formula = "=Sum(" & Cells(1, lngRow).Address & ":" & _
Cells(lngLastColumn, lngRow).Address & ")"
I think , here you have to use Cells(lngRow,lngLastColumn + 1).
My suggestion is to use activesheet.usedrange.rows.count instead of Range.End(xlToRight) and the like statements.
Please revert back if you have any qurties
Jun 3, 2009 at 05:57 AM