Last Updated on January 11, 2023 by token
1. CLngLng VBA function – Description
The CLngLng VBA function returns a value of the LongLong data type . It is an integer ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 . The LongLong data type is 8 bytes in memory. It is important that the LongLong data type itself, unlike the Long type, only works in the 64-bit architecture. The function can also be used to convert a number stored as text to a number in the LongLong data type. Attempting to call a function with an argument outside the range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 will generate an error. We will also get an error when we enter a value that contains characters other than digits as an argument, or we enter a floating point number as an argument
2. VBA CLngLng function – Syntax
CLngLng (Expression) As LongLong
Expression : Any integer from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 stored in any data type (including String).
Function return : LongLong / Integer ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
3. VBA CLngLng function – Example
How to use CLngLng function in VBA Excel? Below are examples of using the CLngLng function in the VisualBasic Editor.
Example 1:
Dim StrNumber As String StrNumber = "14522434566778" MsgBox CLngLng (StrNumber)
Example 2:
Dim intNumber As Integer intNumber = 32000 MsgBox CLngLng (intNumber)
4. VB CLngLng function – Additional information
- A function that is applied to numbers other than integers or outside the range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 will return an error.
- The feature only works on 64-bit architecture, similar to the LongLong data type
5. CLngLng VisualBasic function – Where to use?
The function can be used in: Excel 2013, Excel 2016.
The article is part of the VBA Excel function list. You can find a list of all VBA functions at this address: VBA functions .