Hello again.
My current problem is something I thought would be easy because I thought VBA would have an Auto Sum function, however I have not been able to find one. I'm using Excel 2007.
I have a template that has a summary page. The summary page has seven sections, each section length (in rows) depends on how many sheets the user adds. (i.e. the user adds 7 worksheets, the section will be seven rows). Each row has data grabbed from the worksheet. I want the row, directly below the last row to auto sum the data for that section. See below for example:
Col A Col B
Row 1: 5 16
Row 2: 7 18
Row 3: 8 9
Row 4: 9 5
Row 5: 4 13
Row 6: 16 2
Row 7: (SUM) (SUM)
Row 8: (*Blank*) etc...
Row 9: (*Blank*)
Row 10: (*Blank*)
Row 11: 6
Row 12: 7
Row 13: 25
Row 14: 36
Row 15: 95
Row 16: (SUM)
Row 17: (*Blank*)
Row 18: (*Blank*)
Row 19: (*Blank*)
Row 20: 15
etc...
The columns will always stay constant but because of the sections I can't do range("A9999999".End(xlup)).
I have tried
ActiveAell.Offset(2, 0) 'to get to the desired cell for the sum formula
ActiveCell.FormulaR1C1 = "=SUM(" & ActiveCell.Offset(-1, 0).Address & ":" & ActiveCell.Offset(-1, 0).End(xlUp).Address & ")"
Thanks for any help that can be provided.
My current problem is something I thought would be easy because I thought VBA would have an Auto Sum function, however I have not been able to find one. I'm using Excel 2007.
I have a template that has a summary page. The summary page has seven sections, each section length (in rows) depends on how many sheets the user adds. (i.e. the user adds 7 worksheets, the section will be seven rows). Each row has data grabbed from the worksheet. I want the row, directly below the last row to auto sum the data for that section. See below for example:
Col A Col B
Row 1: 5 16
Row 2: 7 18
Row 3: 8 9
Row 4: 9 5
Row 5: 4 13
Row 6: 16 2
Row 7: (SUM) (SUM)
Row 8: (*Blank*) etc...
Row 9: (*Blank*)
Row 10: (*Blank*)
Row 11: 6
Row 12: 7
Row 13: 25
Row 14: 36
Row 15: 95
Row 16: (SUM)
Row 17: (*Blank*)
Row 18: (*Blank*)
Row 19: (*Blank*)
Row 20: 15
etc...
The columns will always stay constant but because of the sections I can't do range("A9999999".End(xlup)).
I have tried
ActiveAell.Offset(2, 0) 'to get to the desired cell for the sum formula
ActiveCell.FormulaR1C1 = "=SUM(" & ActiveCell.Offset(-1, 0).Address & ":" & ActiveCell.Offset(-1, 0).End(xlUp).Address & ")"
Thanks for any help that can be provided.