Chr 34

CHR is the VBA function and returns the character from the ASCII table.

For example, Chr(34) returns 34th character, which is the “ sign (double quotes).

Example:

Look at this example. Let’s say that you want to insert the following name into the cell using the VBA code.

Edwin “Buzz” Aldrin

You can use one of the two methods.

  1. “Edwin “”Buzz”” Aldrin”
  2. “Edwin “ & chr(34) & “Buzz” & chr(34) & “ Aldrin“

To illustrate you how you can Execute the following macro inside a cell, use this formula.

Both examples will display the name in double quotes.

CAUTION

Don’t confuse the chr function with the CHAR function. The first one is used in VBA, the second one in Excel.