LEN(string | varname)
Returns the number of characters in a string (Long).
|string||The text string (String).|
|varname||The name of the variable (String).|
|* When VBA stores a string in memory, it always stores the length of the string in a long integer at the start of the string.|
* The Len() function retrieves this value and is therefore faster than having to examine the actual characters.
* This function is useful for determining whether a string is a zero-length string ("") and should be used before comparing to a zero length string.
* You must only enter one of the two arguments (either "string" or "varname").
* This function can also be used to determine the number of bytes used to store a variable.
* If "varname" is Null, then Null is returned.
* If "varname" is a Variant then it is treated the same as a string.
* If "varname" is a user defined type, then the size returned is as it will be written to a file is returned.
* You can use the LENB function to use with byte data.
* The equivalent Excel function is LEN
* The equivalent .NET function is Microsoft.VisualBasic.Strings.Len
* For the Microsoft documentation refer to docs.microsoft.com
Len("sometext") = 8
© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top