The_Rock
Board Regular
- Joined
- Jul 2, 2007
- Messages
- 174
Hi Folks
I was wondering if there was a way of making a formula dynamic/generic so that it would subtotal any column I want.
The limitations would be that Row 1 always contains the header and that the result (subtotal) should be offset by 2 rows in the same column. So basically, if I have data in (for example) F2:F10, I could click on any cell in Column F and the subtotal would be in F12
This is a formula I use where I am telling it what Columns/Rows to look at.
The fields marked with ??? is what I would like to be the active column.
I was wondering if there was a way of making a formula dynamic/generic so that it would subtotal any column I want.
The limitations would be that Row 1 always contains the header and that the result (subtotal) should be offset by 2 rows in the same column. So basically, if I have data in (for example) F2:F10, I could click on any cell in Column F and the subtotal would be in F12
This is a formula I use where I am telling it what Columns/Rows to look at.
Code:
Range("X65536").End(xlUp).Offset(2, 0).FormulaR1C1 = "=SUBTOTAL(9,(R2C24:R[-2]C))"
The fields marked with ??? is what I would like to be the active column.
Code:
Range("???65536").End(xlUp).Offset(2, 0).FormulaR1C1 = "=SUBTOTAL(9,(R2C???:R[-2]C))"