Vluggejapie
New Member
- Joined
- Apr 21, 2020
- Messages
- 2
- Office Version
- 2016
- Platform
- Windows
Dear all,
I was hoping if you could help regarding a model I am creating to simulate different portfolio compositions for a financial fund.
I have build a model that generations an x amount of loans with variables which are randomly generated (Type, intererst rate, duration etc.).
The averages of the portfolio are calculated in my first tab Range("B5:B11").
My intention is to create a button that creates a loop to generate a portfolio, copy the results to another sheet and do this x amount of times (G2).
The idea is that you can change the parameters and get an idea what an average return might be after x rolls.
So far, I have the following syntax:
Sub Calculation_loop()
Dim Iteration As Integer, i As Integer
Iteration = Range("G2")
Application.ScreenUpdating = False
For i = 0 To Iteration
Application.Calculate
Range("B5:B11").Copy
Sheets("Simulation").Range("B1" & i).PasteSpecial Transpose:=True
Next i
Application.CutCopyMode = False 'Clear Clipboard
Application.ScreenUpdating = True
End Sub
My problem is that the syntax above only pastes the last roll in its corresponding cell but that the previous cells show 0 / errors.
What am I missing here?
Thanks in advance!
I was hoping if you could help regarding a model I am creating to simulate different portfolio compositions for a financial fund.
I have build a model that generations an x amount of loans with variables which are randomly generated (Type, intererst rate, duration etc.).
The averages of the portfolio are calculated in my first tab Range("B5:B11").
My intention is to create a button that creates a loop to generate a portfolio, copy the results to another sheet and do this x amount of times (G2).
The idea is that you can change the parameters and get an idea what an average return might be after x rolls.
So far, I have the following syntax:
Sub Calculation_loop()
Dim Iteration As Integer, i As Integer
Iteration = Range("G2")
Application.ScreenUpdating = False
For i = 0 To Iteration
Application.Calculate
Range("B5:B11").Copy
Sheets("Simulation").Range("B1" & i).PasteSpecial Transpose:=True
Next i
Application.CutCopyMode = False 'Clear Clipboard
Application.ScreenUpdating = True
End Sub
My problem is that the syntax above only pastes the last roll in its corresponding cell but that the previous cells show 0 / errors.
What am I missing here?
Thanks in advance!