Naming Macro Function Parameters

Scooterman23

New Member
Joined
May 9, 2015
Messages
7
I'm trying to create a macro in Excel that takes in a list of parameters, and I'm having trouble remembering the order to enter the parameters.

Functions defined in excel show the parameter such as = PV(rate, nper, pmt, [fv], [type])

How can I create my Macro to output the name of parameters needed such as pvStudy("initial","operating","revenue","salvage","life","marr","study")


Macro attached:

Function pvStudy(initial As Double, operating As Double, revenue As Double, salvage As Double, life As Double, marr As Double, study As Double) As Double


Dim Rebuy As Double
Dim times As Double
Dim repurchase As Double
Dim AnnualPresent As Double
Dim FinalSalvage As Double


times = Round((study / life), 0)


AnnualPresent = -PV(marr * 0.01, study, (revenue + operating))

For i = 1 To times
tempvar = -PV(marr * 0.01, life * i, (initial + salvage))
repurchase = repurchase + tempvar
Next i

FinalSalvage = -PV(marr * 0.01, study, salvage)

pvStudy = (initial + FinalSalvage + repurchase + AnnualPresent)

End Function
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Also if you enter =pvStudy( and then click the fx button by the side of the formula bar it will show the names of the arguments.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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