How to type currency symbols in Visual Basic Editor

后端 未结 2 1522
猫巷女王i
猫巷女王i 2020-12-07 06:20

There is a project requirement where we need to check a cell for its currency type.

I came across a similar question in this forum (How to check if cell is formatted

相关标签:
2条回答
  • 2020-12-07 06:47

    VBA editor is not Unicode.

    In order to have Unicode characters in it, you need to use ChrW$, e.g.

    Dim Rupee As String
    Rupee = ChrW$(&h20A8&)
    

    Also see Unicode string literals in VBA.

    0 讨论(0)
  • 2020-12-07 07:00

    I have an improved version for the answer... use the following code for making the selection in to Indian rupee Symbol with Lakhs crores format, immaterial of your regional settings in Millions format.

    Dim rs As String
    rs = ChrW$(&H20B9&)
    Selection.NumberFormat = "[>=10000000][$" & rs & "-ta-IN] ##\,##\,##\,##0.00;[>=100000][$" & rs & "-ta-IN] ##\,##\,##0.00;[$" & rs & "-ta-IN] ##,##0.00"
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题