In VBA, we have CHR() function that returns a character based on the ASCII value.
The syntax for CHR() function is
The parameter “Ascii_value” is used to retrieve the character.
How to use:
Dim chrA As String ChrA=CHR(87)
In the above example, chrA will hold a value “W” which is ASCII equivalent to 87.
To insert an IF() statement in a cell as formula, which includes double quotes.
People fix this in two ways
Worksheets("Sheet1").Range("A1").Formula = "IF(Sheet1!A1=0,"""",Sheet1!A1)"
Worksheets("Sheet1").Range("A1").Formula = "IF(Sheet1!A1=0," & CHR(34) & CHR(34) & ",Sheet1!A1)"
In the first way, we may get confused with the number of double quotes to put in whereas in the second example there is no chance of confusion. So, the second one is the nice choice.
See you soon!