# VBA DDB Function

Home ➜ VBA Functions LIST (Category Wise) ➜ **How to use the VBA DDB Function (Syntax + Example)**

## What is VBA DDB Function

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.

## how to use it

To use VBA's DDB function you need to understand its syntax and arguments:

### Syntax

**DDB(Cost, Salvage, Life, Period, [Factor])**

### Arguments

**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].

## Example to use DDB Function in VBA

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.

## Notes

Below are some important points which you need to take care while using DDB function in VBA.

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

## Related Functions

About the Author

Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can ﬁnd him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.