stanhilliard
01-02-2021, 01:25 PM
The following works in VBA when the three parameters (0.05,0,1) are literal constants.
(1) Worksheets("Data").Cells(I, 3).Value = "=-NORMINV(0.05,0,1)"
However, the following fails when the three parameters are variables. I want to be able to change the variables in a loop. This fails:
(2) Worksheets("Data").Cells(I, 3).Value = "=-NORMINV(pp,Mean,SD)"
I tried to convert the three numeric variables to strings but the result still fails. It adds the formula to the cell, but the formula contains the literal names.
I got this to work in worksheet cells:
(3) =-NORMINV(RC[-1],RC[1],RC[2])
but I would like to work in VBA without referencing a worksheet at all. Is there a way to do that with both inputs and output being variables?
(1) Worksheets("Data").Cells(I, 3).Value = "=-NORMINV(0.05,0,1)"
However, the following fails when the three parameters are variables. I want to be able to change the variables in a loop. This fails:
(2) Worksheets("Data").Cells(I, 3).Value = "=-NORMINV(pp,Mean,SD)"
I tried to convert the three numeric variables to strings but the result still fails. It adds the formula to the cell, but the formula contains the literal names.
I got this to work in worksheet cells:
(3) =-NORMINV(RC[-1],RC[1],RC[2])
but I would like to work in VBA without referencing a worksheet at all. Is there a way to do that with both inputs and output being variables?