I have made a custom function using VBA and I need to make it work in my workbook.
While entering this function will the excel show the arguments to be entered like the in-built functions?
What are the other things that I need to take care of?
Following is the vba code for the custom function.
Code:
Function wdvdep(historical_cost As Long, accumulated_depreciation As Long, addition_value As Long, date_of_purchase As Date, dep_date As Date) As Long
Dim h As Long
Dim Acc As Long
Dim Addn As Long
Dim Rt As Long
Dim dt As Date
Dim depval As Long
Dim depdt As Date
depval = h - Acc
If (depdt - dt) > 180 Then
dep = (depval + Addn) * Rt%
Else
dep = depval * Rt% + Addn * Rt% / 2
End If
End Function
Bookmarks