#Name? Error with this code

Stephen57

New Member
Joined
Apr 12, 2011
Messages
4
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

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.005

Step = NPV - TPV

Curve_Plot = (TPV + (Portion * Step)) * Amt

End Function
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
If you have a named range called "namedRange", this shows the syntax for getting the sum of that range

Code:
MsgBox Application.WorksheetFunction.Sum(Range("namedRange"))

The Range("namedRange") syntax should be used throughout your posted code.
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top