Visual Basic Language Reference  

SLN Function

Returns a Double specifying the straight-line depreciation of an asset for a single period.

Function SLN( _
   ByVal Cost As Double, _
   ByVal Salvage As Double, _
   ByVal Life As Double _
) As Double

Parameters

Cost
Required. Double specifying initial cost of the asset.
Salvage
Required. Double specifying value of the asset at the end of its useful life.
Life
Required. Double specifying length of the useful life of the asset.

Exceptions/Errors

Exception type Error number Condition
ArgumentException 5 Life = 0.

Remarks

The depreciation period must be expressed in the same unit as the Life argument. All arguments must be positive numbers.

Example

This example uses the SLN function to return the straight-line depreciation of an asset for a single period given the asset's initial cost (InitCost), the salvage value at the end of the asset's useful life (SalvageVal), and the total life of the asset in years (LifeTime).

Sub TestSLN()
   Dim InitCost, SalvageVal, MonthLife As Double
   Dim LifeTime, Pdepr As Double
   Dim Fmt As String = "###,##0.00"   ' Define money format.
   Const YEARMONTHS As Integer = 12  ' Number of months in a year.

   InitCost = CDbl(InputBox("What's the initial cost of the asset?"))
   SalvageVal = CDbl(InputBox("What's the asset's value at the end of its useful life?"))
   MonthLife = CDbl(InputBox("What's the asset's useful life in months?"))
   Do While MonthLife < YEARMONTHS   ' Ensure period is >= 1 year.
      MsgBox("Asset life must be a year or more.")
      MonthLife = CDbl(InputBox("What's the asset's useful life in months?"))
   Loop
   LifeTime = MonthLife / YEARMONTHS   ' Convert months to years.
   If LifeTime <> Int(MonthLife / YEARMONTHS) Then
      LifeTime = Int(LifeTime + 1)   ' Round up to nearest year.
   End If
   Pdepr = SLN(InitCost, SalvageVal, LifeTime)
   MsgBox("The depreciation is " & Format(Pdepr, Fmt) & " per year.")
End Sub

See Also

DDB Function | FV Function | IPmt Function | IRR Function | MIRR Function | NPer Function | NPV Function | Pmt Function | PPmt Function | PV Function | Rate Function | SYD Function | ArgumentException