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