Excel Tip: How to refer characters using ASCII Value
In this article, I am going to explain you, how can you use special characters in Excel VBA and formulas without breaking the syntax.
For Example: You can not use double quote or any other Special Characters, which are generally a part of Formula Syntax, directly in a cell while using formula because using them, will spoil the syntax of the formula and it will through an error. To overcome this issue, one can use the ASCII number of those characters. ASCII values can be used to refer the characters in both Excel formulas as well as Excel VBA.
Use of ASCII numbers in Excel Formulas as well as Excel VBA programming
CHAR( ASCII Number)
VBA.Chr( ASCII Number)
Here is the list of ASCII keys of few most used symbols which may affect the formula syntax in Excel if they are used as it is:
|Symbol||ASCII Code||Syntax – Excel Formula||Syntax – Excel VBA|
|$ – Dollar Sign||36||=Char(36)||VBA.Chr(36)|
|” – Double Quote||34||=Char(34)||VBA.Chr(34)|
|& – Ampersand Sign||38||=Char(38)||VBA.Chr(38)|
|( – Opening Braces||40||=Char(40)||VBA.Chr(40)|
|) – Closing Braces||41||=Char(41)||VBA.Chr(41)|
|@ – At the rate Sign||64||=Char(64)||VBA.Chr(64)|
My name is Vishwamitra Mishra. Friends Call me Vishwa. This blog is authored by me. I am an Excel Geek. Well, this blog talks a lot about my passion in Excels & Macros so I’ll not talk about it :) I am very much passionate about traveling & quite recently discovered that I am a good photographer too..:P
AND GET A FREE!
E-BOOK FOR EXCEL VBA BEGINNERS
DON'T MISS ANY NEW ARTICLE !
Get your FREE! E-Book & Have Every New Article Delivered Straight To Your Email-Box