Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Relative references in formulas
I am aware of the basic usage of relative references in establishing a
formula. For example to sum a column of cells relative to a given cell the following can be used: ActiveCell.FormulaR1C1="=sum(R[-5]C[-2]:R[-1]C[-2])" However, since the formula is a string, it is not possible to replace, for instance, -5 with a variable. Is there a straightforward way to do this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Relative references in formulas
Dim myVar as double 'your variable MyVar = -5 ActiveCell.FormulaR1C1="=sum(R[" & myVar & "]C[-2]:R[-1]C[-2])" "VegasPines" wrote: I am aware of the basic usage of relative references in establishing a formula. For example to sum a column of cells relative to a given cell the following can be used: ActiveCell.FormulaR1C1="=sum(R[-5]C[-2]:R[-1]C[-2])" However, since the formula is a string, it is not possible to replace, for instance, -5 with a variable. Is there a straightforward way to do this? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Relative references in formulas
ker_01,
Thanks very much. That works just fine. It's great to know there is this kind of help available since getting the same kind of help from the Microsoft help function seems to be impossible. Either I don't know how to ask the question or it is really that difficult. VegasPines -- VegasPines "ker_01" wrote: Dim myVar as double 'your variable MyVar = -5 ActiveCell.FormulaR1C1="=sum(R[" & myVar & "]C[-2]:R[-1]C[-2])" "VegasPines" wrote: I am aware of the basic usage of relative references in establishing a formula. For example to sum a column of cells relative to a given cell the following can be used: ActiveCell.FormulaR1C1="=sum(R[-5]C[-2]:R[-1]C[-2])" However, since the formula is a string, it is not possible to replace, for instance, -5 with a variable. Is there a straightforward way to do this? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Relative references in formulas
Conceptually compared to a database language programming the relativity thing
takes a bit of getting used to. And given the very nature of spreadsheets and that you can add or delete Rows or Columns in an instance that means that anything to do with range definItions in VBA can take some effort. It therefore amazes me that so many of the examples in the Help files only use "A1:D5" style notation rather than more useful relational referencing. -- Ken "Using Dbase dialects since 82" "Started with Visicalc in the same year" "VegasPines" wrote: ker_01, Thanks very much. That works just fine. It's great to know there is this kind of help available since getting the same kind of help from the Microsoft help function seems to be impossible. Either I don't know how to ask the question or it is really that difficult. VegasPines -- VegasPines "ker_01" wrote: Dim myVar as double 'your variable MyVar = -5 ActiveCell.FormulaR1C1="=sum(R[" & myVar & "]C[-2]:R[-1]C[-2])" "VegasPines" wrote: I am aware of the basic usage of relative references in establishing a formula. For example to sum a column of cells relative to a given cell the following can be used: ActiveCell.FormulaR1C1="=sum(R[-5]C[-2]:R[-1]C[-2])" However, since the formula is a string, it is not possible to replace, for instance, -5 with a variable. Is there a straightforward way to do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copying formulas with relative references | Excel Discussion (Misc queries) | |||
Help with converting a block of cells with Absolute and mixed references to relative references | Excel Worksheet Functions | |||
Copying formulas, relative and absolute cell references | Excel Discussion (Misc queries) | |||
Named formulas in CHOOSE need to be Relative references when paste | Excel Worksheet Functions | |||
Confused about relative references in named formulas | Excel Worksheet Functions |