Home ➜ VBA Tutorial ➜ Top VBA Functions ➜ **VBA SLN Function (Syntax + Example)**

The VBA SLN function is listed under the financial category of VBA functions. When you use it in a VBA code, **it calculates the straight line depreciation of an asset for a single period**. Learn more about this calculation from here.

## Syntax

**SLN(Cost, Salvage, Life)**

## Arguments

**Cost**: The initial cost of the asset you are calculating depreciation for.**Salvage**: The ending value of the asset after its useful life.**Life**: The number of periods over which the asset is to be depreciated.

## Example

To practically understand how to use VBA SLN function, you need to go through the below example where we have written a vba code by using it:

```
Sub example_SLN()
Range("A7").Value = SLN(15000, 1200, 8)
End Sub
```

In the above code, we have used the SLN to calculate the straight-line depreciation using the cost, salvage, and life period and it has returned 1725 in the result as per the inputs specified.

## Notes

- If the life supplied is equal to zero then VBA will return a run-time 5 error.

## Related Functions

DDB | FV | IPMT | IRR | MIRR | NPER | NPV | PMT | PV | RATE | SYD