Hi
I need to put in a SUM formula at the end on some columns of data. The issue is, the range of the columns are dynamic.
Based on other code, I have the locations of these columns, however I don't know how to pass them into the SUM formula. I thought using the .formulaR1C1 method would be easier but not sure.
How do I change the [-3] to be able to pass a value? It could be -5 or -4 for example.
Thanks!
Dava
I need to put in a SUM formula at the end on some columns of data. The issue is, the range of the columns are dynamic.
Based on other code, I have the locations of these columns, however I don't know how to pass them into the SUM formula. I thought using the .formulaR1C1 method would be easier but not sure.
Code:
ActiveCell.Formula = "=sum(R2C[-3]:R2C[-1])"
How do I change the [-3] to be able to pass a value? It could be -5 or -4 for example.
Thanks!
Dava