In a Sub I have this code:
Note that myField is a column (in a database area, myField is the field name of the column) so the formula is calulated on all cells in the column, and for each cell in the column the arguments are from cells on the same row.
Now, instead of the fix values -3 and -1, I want to use variables
e.g.
column1 = -3
column2 = -1
What is the syntax?
I have tried several versions with "& variable &", for exampel:
But it doesn't work.
Regards Hanna
Code:
Application.Goto Reference:="myField" Selection.FormulaR1C1 = "=RC[-3]+RC[-1]"
Note that myField is a column (in a database area, myField is the field name of the column) so the formula is calulated on all cells in the column, and for each cell in the column the arguments are from cells on the same row.
Now, instead of the fix values -3 and -1, I want to use variables
e.g.
column1 = -3
column2 = -1
What is the syntax?
I have tried several versions with "& variable &", for exampel:
Code:
Selection.FormulaR1C1 = "=RC["& column1 &"]+RC["& column2 &"]"
But it doesn't work.
Regards Hanna