I am trying to create a UDF to minimize the lines of data in a calculation. Rather than include the stated calculation of specific cell references, I want to create a variable called Rent_Rate and set it equal to Base_year_rent * ((1 + Rent_escalator)^Compound_period) so that the formula in the spread sheet reads "= Rent_Rate * Units (a static cell reference)"
I've tried defining the variables and setting each variable to the reference cell that I want (on a separate sheet) to reference.
Public Function Rent_Rate(Base_year_rent As Long, Rent_escalator As Long, Compound_period As Long, Rent_Rate As Long) As Long
Base_year_rent = SH_Assumptions.Cells("C11")
Rent_escalator = SH_Assumptions.Cells("C12")
Compound_period = Year(Range(ActiveCell, ActiveCell.End(xlUp)).Select) - Year(SH_Assumptions.Cells("C4"))
Rent_Rate = Base_year_rent * ((1 + Rent_escalator) ^ Compound_period)
End Function
I expect that the output would be a specific value equal to the values entered into the cells being referenced.