+ Reply to Thread
Results 1 to 6 of 6

Concatenate with a Unicode Character

Hybrid View

  1. #1
    Registered User
    Join Date
    07-02-2013
    Location
    Fort Campbell, KY
    MS-Off Ver
    Excel 2010 for Windows
    Posts
    3

    Concatenate with a Unicode Character

    Hi,
    I've been searching numerous forums looking for this answer and I can't figure this one out.

    I'm trying to get VBA to update a cell on a spreadsheet to read the following formula:

    =CONCATENATE("≤",adminLowDaysFlightMax," HRs")
    This would give me a result like "≤74 Hrs" in that cell depending on the variable in the listed adminLowDaysFightMax range.

    VBA does not recognize the "≤" symbol so I have to use the unicode reference of ChrW(&H2264).

    This code works without the symbol I want:
    Range("N15") = "=CONCATENATE("">"",adminLowDaysFlightMax,"" HRs"")"
    No matter where I put the quotations or & signs in this formula, I cannot get it to accept the "ChrW(&H2264)" in place of the ">".

    Please help.

    Thank you,
    Landon

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Concatenate with a Unicode Character

    ChrW is a VBA funtion, but not a worksheet function.

    You could use the non-unicode character CHAR(178)
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    07-02-2013
    Location
    Fort Campbell, KY
    MS-Off Ver
    Excel 2010 for Windows
    Posts
    3

    Re: Concatenate with a Unicode Character

    Mike,
    I'm glad you pointed out that ChrW would not be recognized in a worksheet. The Char(178) gave me a post script 2. Looking through the hex and non-unicode characters, the ≤ character does not exist. Excel 2013 added a new formula "=UNICODE()" but I'm using 2010 so I was SOL. I did figure out that I could have VBA write the ≤ character by itself somewhere else int he workbook then use a regular reference formula to make it work.

    =CONCATENATE(DEV!$A$11,adminLowDaysFlightMax," HRs")
    VBA would write this formula and it fixed the problem; indirectly, but solved. Thank you for pointing out the differences.

    -Landon

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Concatenate with a Unicode Character

    You could write a UDF

    Function Unicode(aVal as Variant) As String
        Unicode = ChrW(aVal)
    End Function

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Concatenate with a Unicode Character

    activecell.Formula="=CONCATENATE(" & chr(34) & chrw(&H2264) & chr(34) & ",adminLowDaysFlightMax," & chr(34) & " Hrs" & chr(34) & ")"
    To avoid the confusion about double quotes use Chr(34)

    The above will result in the formula being set in the active cell.

    =CONCATENATE("≤",adminLowDaysFlightMax,"Hrs")
    Cheers
    Andy
    www.andypope.info

  6. #6
    Registered User
    Join Date
    07-02-2013
    Location
    Fort Campbell, KY
    MS-Off Ver
    Excel 2010 for Windows
    Posts
    3

    Re: Concatenate with a Unicode Character

    I think that either of the last two suggestions would have fixed it. I did use Andy's on it and it worked perfectly. I can push out the patch to my safety officers now. Thanks a lot guys. I am usually saved by this forum before I have to ask for help. Keep up the awesome work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 12-18-2016, 03:04 PM
  2. Concatenate regular expressions AND searching for "=" character
    By AnnieMcken in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-07-2014, 11:41 AM
  3. [SOLVED] How to display unicode character in Visual Basic script.
    By kiendt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2006, 09:10 PM
  4. How to convert a Chinese character into unicode number?
    By Richard Hsiao in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2005, 09:05 AM
  5. Can I use Excel to convert Chinese character into Unicode?
    By Richard Hsiao in forum Excel General
    Replies: 0
    Last Post: 09-22-2005, 06:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1