30 Advanced Excel Tips for 2026

Excel Champs / VBA / Top VBA Functions / VBA CLNG Function (Syntax + Example)
By Puneet Gogia (Microsoft MVP)

VBA CLNG Function (Syntax + Example)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

The VBA CLNG function is listed under the data type conversion category of VBA functions. When you use it in a VBA code, it converts an expression into a long data type. In simple words, in VBA the long data type value can be anything between -2,147,483,648 and 2,147,483,647 (without any decimals).

Syntax

CLng(Expression)

Arguments

  • Expression: The value which you want to convert to the long data type.

Example

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

example-vba-clng-function
Sub example_CLNG()
Range("B1").Value = CLng(Range("A1"))
End Sub

In the above example, we used the value from cell A1 (134.567) and then we used the CLNG function to convert that value into a long data type and it returned 135 in the result.

Notes

  • CLNG will round that number that is greater than 0.5 and round down if lower than or equals 0.5.
  • If you supply a number that is out of the range of long data type (- 2.1 E+9 and 2.1 E+9), VBA will return the run-time 13 error.
Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel