I'm confused with the error message I'm receiving with this code. There are named ranges within the workbook that I'm writing this in with range names as indicated in the code.
Public Function Curve_Plot(Curve As String, Amt As Double, Current_Mo As Double, First_Mo As Double, Duration As Double) As Double
Dim Curve_Index As Integer
Dim RP As Double
Dim TP As Double
Dim TPV As Double
Dim NPV As Double
Dim Portion As Double
Dim Step As Double
Step = NPV - TPV
Curve_Plot = (TPV + (Portion * Step)) * Amt
End Function
Public Function Curve_Plot(Curve As String, Amt As Double, Current_Mo As Double, First_Mo As Double, Duration As Double) As Double
Dim Curve_Index As Integer
Dim RP As Double
Dim TP As Double
Dim TPV As Double
Dim NPV As Double
Dim Portion As Double
Dim Step As Double
Curve_Index = Application.WorksheetFunction.VLookup(Curve, Table_Curves, 2, False)
RP = ((Current_Mo + 1) - First_Mo) / Duration
TP = Application.WorksheetFunction.HLookup(RP, Table_Cum, 1)
TPV = Application.WorksheetFunction.HLookup(TP, Table_Cum, Curve_Index)
NPV = Application.WorksheetFunction.HLookup(TP + 0.005, Table_Cum, Curve_Index)
Portion = (RP - TP) / 0.005RP = ((Current_Mo + 1) - First_Mo) / Duration
TP = Application.WorksheetFunction.HLookup(RP, Table_Cum, 1)
TPV = Application.WorksheetFunction.HLookup(TP, Table_Cum, Curve_Index)
NPV = Application.WorksheetFunction.HLookup(TP + 0.005, Table_Cum, Curve_Index)
Step = NPV - TPV
Curve_Plot = (TPV + (Portion * Step)) * Amt
End Function