The VBA SLN Function

Related Functions:
VBA DDB
VBA SYD

Description

The VBA SLN function calculates the straight line depreciation of an asset for a single period.

The syntax of the function is:

SLN( Cost, Salvage, Life )

Where the function arguments are:

 Cost - The initial cost of the asset. 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.

VBA SLN Function Example

In the example below, the VBA SLN function uses the straight line depreciation method to calculate the yearly depreciation of an asset that cost \$10,000 at the start of year 1, and has a salvage value of \$1,000 after 5 years.

 ' Calculate the yearly depreciation of an asset that cost \$10,000 at' the start of year 1, and has a salvage value of \$1,000 after 5 years.Dim yrly_dep As Doubleyrly_dep = SLN( 10000, 1000, 5 )' yrly_dep is calculated to be 1800.

The above call to the VBA SLN function calculates the yearly depreciation of the asset to be \$1,800.

Therefore, as expected, the total depreciation of the asset over 5 years is \$9,000.

VBA SLN Function Error

If the supplied Life argument is equal to 0, the VBA SLN produces the error:

Run-time error '5': Invalid procedure call or argument 