Dim n As Double
n = Sh.Range("B10").Value
Dim rate As Double
rate = (datefin - datedepart) / n
Cells(13, n + 3) = datefin
For y = n - 1 To x Step -1
Cells(13, y + 3) = datefin - rate
datefin = datefin - rate
Next y
I have this simple for
loop, that puts the values into the cells in excel starting from n
(given by the user) and going backwards according to a rate
(which is also calculated by values given by the user).
The output values I get are correct, but I would like to make my formulas visible in excel. For example, if I press on the cell D13
I would like it to show the formula I used. I tried to do it with the ActiveCell.Formula
or ActiveCell.FormulaR1C1
function but since n
is not always a specific number (and hence on a specific cell) I cannot find how to execute what I want.
Thank you!!!