rmoon
06-18-2015, 07:45 AM
I'm trying to write a code that will increase the size of a range that is being summed by one cell each time I run the macro.
Example: SUM(B6:F6) will turn into SUM(B6:G6) after one run of the macro, etc. I've tried recording and using relative references but that didn't work out.
Here's the first run of the code I was trying:
Range("O5").Select
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=+SUM(RC[-13]:RC[-9])"
ActiveCell.Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A5"), Type:= _
xlFillDefault
ActiveCell.Range("A1:A5").Select
Is there a way to get this concept to work?
Thanks!
Example: SUM(B6:F6) will turn into SUM(B6:G6) after one run of the macro, etc. I've tried recording and using relative references but that didn't work out.
Here's the first run of the code I was trying:
Range("O5").Select
ActiveCell.Select
ActiveCell.FormulaR1C1 = "=+SUM(RC[-13]:RC[-9])"
ActiveCell.Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A5"), Type:= _
xlFillDefault
ActiveCell.Range("A1:A5").Select
Is there a way to get this concept to work?
Thanks!