Consulting

Results 1 to 3 of 3

Thread: Symbol - VBA reference - Need help!

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    51
    Location

    Symbol - VBA reference - Need help!

    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
    Attached Files Attached Files

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    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.
    Last edited by Kenneth Hobs; 06-25-2015 at 01:46 PM.

  3. #3
    VBAX Regular
    Joined
    Jul 2008
    Posts
    51
    Location
    Quote Originally Posted by Kenneth Hobs View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •