adilh301
06-13-2016, 06:55 AM
I'm new to VBA and just want to understand some of my code.
the book im working from does very little to explain this but what am i doing here? I know when complete it populates a table but how is this section of code doing this?
'loop to calculate and output year-by year amort. table
For rowNum = 1 To LoanLife
intComp = yrBegBal * intrate
princerepay = annualpmnt - intComp
YrEndBal = yrBegBal - princerepay
Cells(outRow + rowNum + 3, 3).Value = rowNum
Cells(outRow + rowNum + 3, 4).Value = yrBegBal
Cells(outRow + rowNum + 3, 5).Value = annualpmnt
Cells(outRow + rowNum + 3, 6).Value = intComp
Cells(outRow + rowNum + 3, 7).Value = princerepay
Cells(outRow + rowNum + 3, 8).Value = YrEndBal
yrBegBal = YrEndBal
Next rowNum
some other parts of the overall program that may help you to help me.
outRow = 5 'Used to control where the output table will start
outSheet = "Loan"
the book im working from does very little to explain this but what am i doing here? I know when complete it populates a table but how is this section of code doing this?
'loop to calculate and output year-by year amort. table
For rowNum = 1 To LoanLife
intComp = yrBegBal * intrate
princerepay = annualpmnt - intComp
YrEndBal = yrBegBal - princerepay
Cells(outRow + rowNum + 3, 3).Value = rowNum
Cells(outRow + rowNum + 3, 4).Value = yrBegBal
Cells(outRow + rowNum + 3, 5).Value = annualpmnt
Cells(outRow + rowNum + 3, 6).Value = intComp
Cells(outRow + rowNum + 3, 7).Value = princerepay
Cells(outRow + rowNum + 3, 8).Value = YrEndBal
yrBegBal = YrEndBal
Next rowNum
some other parts of the overall program that may help you to help me.
outRow = 5 'Used to control where the output table will start
outSheet = "Loan"