The VBA DDB function is listed under the financial category of VBA functions. When you use it in a VBA code, it can calculate depreciation by using the double declining balance method or you can supply the depreciation rate directly into the function. Learn more about the double declining balance method from here.
DDB(Cost, Salvage, Life, Period, [Factor])
- Cost: The initial cost of the asset.
- Salvage: The value of the asset at the end.
- Life: The number of periods over which the asset is to be depreciated.
- Period: The period for which you want to calculate the depreciation.
- Factor: Rate of depreciation [This is an optional argument and if omitted VBA takes 2 by default].
To practically understand how to use VBA DDB function, you need to go through the below example where we have written a vba code by using DDB:
Sub example_DDB() Range("B6").Value = DDB(14500, 500, 10, 10) End Sub
In the above code, we have used DBB to calculate the depreciation of the asset and it has returned 389 in the result.
- With the double-declining balance method, depreciation is highest in the first period and decreases in successive periods.
- VBA will return run-time error ‘5’ (invalid procedure call or argument) if salvage value is less than zero, Life, Period or [Factor] is equal or less than zero, or period of depreciation is greater than the life of the asset.