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 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 the 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.
More Tutorials
⇠Back to VBA Function List | What is VBA in Excel
Helpful Links – Developer Tab – Visual Basic Editor – Run a Macro – Personal Macro Workbook – Excel Macro Recorder – VBA Interview Questions – VBA Codes