![]() |
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? |
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 |
All times are GMT +1. The time now is 07:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com