VBA Chr function

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading...

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:

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:

Simply the best place to learn Excel VBA