Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using variable in formula
Public Sub test()
hv = Range("aa1") Cells(i + 5, 23).Offset(step, 0).Formula = "=+RC[-1]*52*hv" End Sub Range("aa1") contains the value 269.1. The value in RC[-1] is 3758.7. The cell in position 5,23++ does not recognize hv as a number but just shows "hv" with the rest of the formula. How can I fix this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using variable in formula
You're using R1C1 reference style. So use .FormulaR1C1.
And you don't need that leading + in the formula: Cells(i + 5, 23).Offset(step, 0).FormulaR1C1 = "=RC[-1]*52*" & hv Erik wrote: Public Sub test() hv = Range("aa1") Cells(i + 5, 23).Offset(step, 0).Formula = "=+RC[-1]*52*hv" End Sub Range("aa1") contains the value 269.1. The value in RC[-1] is 3758.7. The cell in position 5,23++ does not recognize hv as a number but just shows "hv" with the rest of the formula. How can I fix this? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to get variable from a formula | Excel Programming | |||
Variable within a formula | Excel Worksheet Functions | |||
formula containing a formula-dependent variable - how? | New Users to Excel | |||
Variable in formula | Excel Programming | |||
Help With a Variable Formula | Excel Programming |