The VBA Asc function returns an integer representing the character code for the first character of a supplied string.
The syntax of the function is:
Where the String argument is the text string for which you want the character code of the first character.
' Return the character codes for the first characters of three strings
Dim code1 As Integer
Dim code2 As Integer Dim code3 As Integer
code1 = Asc( "a" )
' code1 is now equal to 97
code2 = Asc( "alpha" )
code3 = Asc( "Alpha" )' code2 is now equal to 97 ' code3 is now equal to 65 |
After running the above VBA code: