CHR 34 in VBA

Written by

Mel Jenkins

Reviewed by

Steve Rynearson

Last updated on May 2, 2022

This article will explain the role of chr 34 in VBA.

Every character in Excel has an assigned number code. The Chr Function (when combined with a number) returns a value from the ASCII table that corresponds to the number that has been used.

When this function is combined with the number 34, it will return double-quotes.

Inserting a Double-Quote into a String

Occasionally, inserting a double-quote into a string makes the string easier to read and to understand. We use the Chr function together with the number 34 to do this.

vba chr nickname example

In the above code snippet, we are showing the name of a person in a message box, including his nickname which many might think is actually his name!

vba chr nickname msgbox

 

vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples