Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using variables in RCs
Hi. I would like to have the following formula contain a variable if
possible. For instance, instead of having "RC[-10]", I would like to have "RC[-j]" where "j" is a variable. Is there a way to do this? ActiveCell.FormulaR1C1 = "=IF((RC[-10]+RC[-4])0,RC[-10]/(RC[-10]+RC[-4]),na())" Thanks, Mike. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using variables in RCs
Try:
"=IF((RC[-" & j & "]+...." etc. -- Vasant "Mike D." wrote in message ... Hi. I would like to have the following formula contain a variable if possible. For instance, instead of having "RC[-10]", I would like to have "RC[-j]" where "j" is a variable. Is there a way to do this? ActiveCell.FormulaR1C1 = "=IF((RC[-10]+RC[-4])0,RC[-10]/(RC[-10]+RC[-4]),na())" Thanks, Mike. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using variables in RCs
To make the debugging easier, I usually do it like this:
Dim s As String j = 10 k = 4 s = "=IF((RC[##]+RC[@@])0,RC[##]/(RC[##]+RC[@@]),na())" s = Replace(s, "##", Format(-j)) s = Replace(s, "@@", Format(-k)) This way, I find it easier to ensure I have the basic formula correct. On Tue, 1 Mar 2005 08:37:04 -0800, "Mike D." wrote: Hi. I would like to have the following formula contain a variable if possible. For instance, instead of having "RC[-10]", I would like to have "RC[-j]" where "j" is a variable. Is there a way to do this? ActiveCell.FormulaR1C1 = "=IF((RC[-10]+RC[-4])0,RC[-10]/(RC[-10]+RC[-4]),na())" Thanks, Mike. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Not at all clear on use of variables and/or object variables | Excel Discussion (Misc queries) | |||
Too Many Variables | Excel Worksheet Functions | |||
Three Variables | Excel Worksheet Functions | |||
Using variables . . . | Excel Discussion (Misc queries) | |||
DIm Variables | Excel Programming |