PDA

View Full Version : [SOLVED] Symbol - VBA reference - Need help!



mitko007
06-25-2015, 12:38 PM
Hi guys,

i have a kind of a strange issue here. I want to write a short macro which should perform some checks in a couple of excel sheets that i'll be receiving. I got an example of the data and instead of yes or nos, ones or zeros it contains ticks and crosses. I'm attaching an example with the two symbols. My question is, first how do i write a symbol like this in excel (i searched through the symbol list but without success) and second and more important how do i refer to these in VBA - e.g. if cell A1 = "the strange tick" --> B2 = "VALID" elseif A1="strange cross" B2 is "NOT VALID"

Thanks a lot,

regards

Kenneth Hobs
06-25-2015, 01:33 PM
Use ascw() to get the number of the symbol character and chrw() to insert the character.
e.g.



Range("A1").Value=chrw(10007) 'x script symbol
Range("A1").font.Color=vbred
Range("A2").Value=chrw(10003) 'check symbol
Range("A2").font.Color=Range("C3").font.Color
You can also use StrConv() to see if the string converted to or from Unicode is what you expected.

mitko007
06-25-2015, 01:46 PM
Use ascw() to get the number of the symbol character and chrw() to insert the character.
e.g.



Range("A1").Value=chrw(10007) 'x script symbol
Range("A1").font.Color=vbred
Range("A2").Value=chrw(10003) 'check symbol
Range("A2").font.Color=Range("C3").font.Color

Thnks Kenneth, that was exactly what i was looking for.

Regards