Sub
Start_NPV_analysis()
Dim
rowend
As
Long
, colend
As
Long
, rowindex
As
Long
, colindex
As
Long
, xrow
As
Long
, xcol
As
Long
Dim
npvval
As
Double
, index
As
Long
colend = Worksheets(
"Exercise 3"
).Cells(3, Columns.Count).
End
(xlToLeft).Column - 5
rowend = Range(
"E"
& Rows.Count).
End
(xlUp).Row - 4
Dim
NPVarray()
As
Double
Dim
output()
As
Double
rowindex = 0
colindex = 0
xrow = 4
xcol = 5
index = 0
ReDim
NPVarray(rowend, colend)
ReDim
output(colend)
Do
Until
Cells(xrow, xcol).Value =
""
Do
Until
Cells(xrow, xcol).Value =
""
NPVarray(rowindex, colindex) = Cells(xrow, xcol)
colindex = colindex + 1
xcol = xcol + 1
Loop
xcol = 5
colindex = 0
xrow = xrow + 1
rowindex = rowindex + 1
Loop
Do
Until
Cells(xrow, xcol).Value =
""
output(index) = NPV(Cells(3, xcol), NPVarray(, index))
index = index + 1
xcol = xcol + 1
Loop
End
Sub