Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
cell referencing with variables
I need some help. I need to populate a formula where the rows and columns
are variable. My first formula works. My second formula gets hung up on the variable "x". Note ColumnNumbers 1 and 2 always change, but never less than 3 and 5 respectively, x is always columnnumber1 + 1 Cells(i, ColumnNumber1).FormulaR1C1 = "=SUM(RC2:RC[-1])" ' Cells(i, ColumnNumber2).FormulaR1C1 = "=SUM(RC[-x]:RC[-1])" Is there another way of doing this formula? I am fairly new at VBA. Thank you, Liesbeth |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
cell referencing with variables
Assuming the value of x is being set somewhere else in the code,
Cells(i, ColumnNumber2).FormulaR1C1 = "=SUM(RC[-" & x & "]:RC[-1])" "Liesbeth" wrote: I need some help. I need to populate a formula where the rows and columns are variable. My first formula works. My second formula gets hung up on the variable "x". Note ColumnNumbers 1 and 2 always change, but never less than 3 and 5 respectively, x is always columnnumber1 + 1 Cells(i, ColumnNumber1).FormulaR1C1 = "=SUM(RC2:RC[-1])" ' Cells(i, ColumnNumber2).FormulaR1C1 = "=SUM(RC[-x]:RC[-1])" Is there another way of doing this formula? I am fairly new at VBA. Thank you, Liesbeth |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
cell referencing with variables
Thank you!
"Vergel Adriano" wrote: Assuming the value of x is being set somewhere else in the code, Cells(i, ColumnNumber2).FormulaR1C1 = "=SUM(RC[-" & x & "]:RC[-1])" "Liesbeth" wrote: I need some help. I need to populate a formula where the rows and columns are variable. My first formula works. My second formula gets hung up on the variable "x". Note ColumnNumbers 1 and 2 always change, but never less than 3 and 5 respectively, x is always columnnumber1 + 1 Cells(i, ColumnNumber1).FormulaR1C1 = "=SUM(RC2:RC[-1])" ' Cells(i, ColumnNumber2).FormulaR1C1 = "=SUM(RC[-x]:RC[-1])" Is there another way of doing this formula? I am fairly new at VBA. Thank you, Liesbeth |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help! Need to lookup referencing 2 variables | Excel Worksheet Functions | |||
referencing a value from a chart with 3 variables | New Users to Excel | |||
Referencing Controls Using Variables | Excel Programming | |||
referencing with variables | Excel Programming | |||
Referencing Variables | Excel Worksheet Functions |