Calculate the sum of rows using macro
Solved/Closed
Related:
- Which feature is used to calculate the sum of rows and columns, in excel?
- Number to words in excel - Guide
- Gif in excel - Guide
- How to take screenshot in excel - Guide
- How to calculate 90 days from date in excel - Guide
- How to change date format in excel - Guide
1 response
Excelguru
Posts
261
Registration date
Saturday April 11, 2009
Status
Member
Last seen
June 21, 2011
307
Jun 3, 2009 at 03:58 AM
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