I want to write a code into a VBA excel. I have prepared the algorithm that is shown below, but I do not know exactly how I will write it in VBA :/ Can someone help me with this?
1) Assign initial values: Current is 1, Year is 0, Result is empty string.
2) Generate a random variate u from U(0,1);
3) If Current is 1, and u ≤ 0.23, assign 0 to Current. If Current is 0, and u > 0.86, assign 1 to Current. Otherwise do nothing.
4) Increase Year by 1. Write Current at the end of the Result string.
5) If Year less than cell("A2").value, go to step (2). Otherwise return Result