Asc function

Category: Conversion

Summary

ASCII code of first character.

Syntax

Asc(string) The required string argument is any valid string expression. If the string contains no characters, a run-time error occurs.

Example

Example
This example uses the Asc function to return a character code corresponding to the first letter in the string.
Dim MyNumber
MyNumber = Asc("A") ' Returns 65.
MyNumber = Asc("a") ' Returns 97.
MyNumber = Asc("Apple") ' Returns 65.

Microsoft Support Page

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/asc-function

Back to Functions