TOP

VBA Function: Asc

YouLibreCalc for Excel logo

Description

The VBA ASC Function returns the integer corresponding to the character passed as an argument.


ASC Syntax

Asc(character)

VBA Asc Example

Display of the whole number corresponding to the character "a":

Sub AscExample()

  MsgBox Asc("a") 'Returns: 97
  
End Sub

LIST OF VALUES

Here are the integers returned by the ASC Function for a selection of the most common characters:

Argument Result Argument Result Argument Result Argument Result
! 33 9 57 Q 81 i 105
" 34 : 58 R 82 j 106
# 35 ; 59 S 83 k 106
$ 36 < 60 T 84 l 108
% 37 = 61 U 85 m 109
& 38 > 62 V 86 n 110
' 39 ? 63 W 87 o 111
( 40 @ 64 X 88 p 112
) 41 A 65 Y 89 q 113
* 42 B 66 Z 90 r 114
+ 43 C 67 [ 91 s 115
, 44 D 68 / 92 t 116
- 45 E 69 ] 93 u 117
. 46 F 70 ^ 94 v 118
/ 47 G 71 _ 95 w 119
0 48 H 72 ` 96 x 120
1 49 I 73 a 97 y 121
2 50 J 74 b 98 z 122
3 51 K 75 c 99 { 123
4 52 L 76 d 100 | 124
5 53 M 77 e 101 } 125
6 54 N 78 f 102 ~ 126
7 55 O 79 g 103
8 56 P 80 h 104
The inverse function that returns the character based on its number is the CHR function.