VBA Chr function

Chr Function Description

The VBA Chr function returns a character based on the ASCII character codes.

Syntax

The syntax for the Chr function in VBA is:

Chr( ascii_value )

Parameters

ascii_character
The ascii_character value for the character.

Excel ASCII Character Map

Below is a mapping of Excel Characters to their ascii values:
excel character map

Other Notes

The Chr function is opposite to the Asc function which returns the character value.

Be aware that some common characters as encoded in VBA as constants e.g. new lines as vbNewLine.

Example usage

The Chr function can only be used in VBA code. Let’s look at some Chr function examples:

Chr 41
Result: ")"

Chr 109
Result: "m"