The VBA DDB function calculates the depreciation of an asset during a specified period, using the Double Declining Balance Method, or another specified depreciation rate.
The syntax of the function is:
Where the function arguments are:
|Salvage||-||The value of the asset at the end of its useful life.|
|Life||-||The number of periods over which the asset is to be depreciated.|
|Period||-||The period number for which you want to calculate the depreciation.|
' Calculate the yearly depreciation of an asset that cost $10,000 at' Calculate the depreciation during year 5
' the start of year 1, and has a salvage value of $1,000 after 5 years.
Dim ddb_yr1 As Double
Dim ddb_yr2 As Double
Dim ddb_yr3 As Double
Dim ddb_yr4 As Double
Dim ddb_yr5 As Double
ddb_yr5 = DDB( 10000, 1000, 5, 5 )
' ddb_yr5 is now equal to 296.
|Depreciation during year 1 = $4,000;|
Depreciation during year 2 = $2,400;
Depreciation during year 3 = $1,440;
Depreciation during year 4 = $864;
Depreciation during year 5 = $296.
Note that the five calculated depreciation values add up to $9,000, which, as expected, is the difference between the cost, $10,000 and the salvage value, $1,000.
The VBA DDB function produces the Run-time error '5': Invalid procedure call or argument if either: