MrTreasury
New Member
- Joined
- May 17, 2019
- Messages
- 11
Hello Forum,
I'm stuck and require your help.
I'm currently trying to produce a macro which fills cells down by row and then move onto column. As the macro moves onto the next column, the number of rows decreases (It'll look like stairs when complete)
The general jist of the spreadsheet is related to forward rates in Foreign Currency. We have created what we want using IFERROR, but ideally want this to be done by a macro.
Here is a snippet of the macro. Apologies if this isn't well written, it is rather difficult to explain.
Currently, the code will complete one column and then end. So I'm unsure as to why the loop isn't moving into the next column, so I put a loop in a loop as per below.
Please ask away any questions.
Thanks, Mr T.
I'm stuck and require your help.
I'm currently trying to produce a macro which fills cells down by row and then move onto column. As the macro moves onto the next column, the number of rows decreases (It'll look like stairs when complete)
The general jist of the spreadsheet is related to forward rates in Foreign Currency. We have created what we want using IFERROR, but ideally want this to be done by a macro.
Here is a snippet of the macro. Apologies if this isn't well written, it is rather difficult to explain.
Currently, the code will complete one column and then end. So I'm unsure as to why the loop isn't moving into the next column, so I put a loop in a loop as per below.
Please ask away any questions.
Thanks, Mr T.
Code:
M = 9
N = 6
TimeM = 9
TimeN = 5
Maturity = ws1.Cells(M, N).Value
Time = ws1.Cells(TimeM, TimeN).Value
R = 9 ' row
O = 7
T = 9
For i = 1 To 18
For j = 1 To 18
If Time < Maturity Then
ws1.Cells(R, O).Value = 0
ElseIf Time >= Maturity Then
ws1.Cells(R, O).Value = ws1.Cells(T, 3).Value / ws1.Cells(28, O).Value '''''
Else
ws1.Cells(R, O).Value = 0
M = M + 1
N = N + 1
TimeM = TimeM + 1
TimeN = TimeN + 1
'R = R + 1
O = O + 1
End If
Next j
R = R + 1
T = T + 1
Next i
End Sub