TYPENAME(varname)

Returns the data type of the variable as a string (String).


varnameThe data type name, expression or variable (Object).

REMARKS
* The string returned by this function is the class name.
* For an illustrated example refer to the TypeName Function page.
* You can use the VARTYPE function to return a number indicating the data type.
* The equivalent .NET function is Microsoft.VisualBasic.Information.TypeName
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print TypeName("String")   '= "String"  
Debug.Print TypeName(1) '= "Integer"
Debug.Print TypeName(10.4) '= "Double"

Dim vVariant As Variant
sVariant = CDec(10.5)
Debug.Print TypeName(vVariant) '= "Decimal"

Dim sTemp As String
Debug.Print TypeName(sTemp) '= "String"

If TypeName(Application.Selection) = "Range" Then
End If

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited Top