ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic FormulaR1C1 value (https://www.excelbanter.com/excel-programming/338572-dynamic-formular1c1-value.html)

Nuraq

Dynamic FormulaR1C1 value
 
I have the following statement:

ActiveCell.FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"

I would like to replace the -4 with a count variable that I created:

ActiveCell.FormulaR1C1 = "=SUM(R[-Count]C:R[-1]C)"

This is not working. The idea is that I want to sum Count number of cells
above my active cell.

Help please?



Tim Williams

Dynamic FormulaR1C1 value
 
ActiveCell.FormulaR1C1 = "=SUM(R[-" & Count & "]C:R[-1]C)"

Tim

"Nuraq" wrote in message
...
I have the following statement:

ActiveCell.FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"

I would like to replace the -4 with a count variable that I created:

ActiveCell.FormulaR1C1 = "=SUM(R[-Count]C:R[-1]C)"

This is not working. The idea is that I want to sum Count number of
cells above my active cell.

Help please?




Tom Ogilvy

Dynamic FormulaR1C1 value
 
ActiveCell.FormulaR1C1 = "=SUM(R[-" & _
Count & "]C:R[-1]C)"

--
Regards,
Tom Ogilvy



"Nuraq" wrote in message
...
I have the following statement:

ActiveCell.FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"

I would like to replace the -4 with a count variable that I created:

ActiveCell.FormulaR1C1 = "=SUM(R[-Count]C:R[-1]C)"

This is not working. The idea is that I want to sum Count number of cells
above my active cell.

Help please?






All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com