Macro to format Currency in Armenian DRAM

kevanr

New Member
Joined
Nov 7, 2019
Messages
14
Hi

I have a multi-currency model that allows the user to format using a selection from a number of different currencies e.g. USD, GBP, EUR etc with their relevant currency symbols.

An example of the code within the macro is as follows:

' For USD:
Selection.NumberFormat = _
"_-[$$-en-US]* #,##0_ ;[Red]_-[$$-en-US]* -#,##0 ;_-[$$-en-US]* ""-""??_ ;_-@_ "

' For EUR:
Selection.NumberFormat = _
"_-[$€-x-euro2] * #,##0_ ;[Red]_-[$€-x-euro2] * -#,##0 ;_-[$€-x-euro2] * ""-""_ ;_-@_ "

These all run perfectly.

I am attempting to provide a format for the Armenian DRAM. In Excel the default format is [$֏-hy-AM] however when I use it the dram currency symbol "֏" comes up as a "?" in the format. In other words the code gets changed to [$?-hy-AM]

Can anybody help me solve this problem.

Many thanks
 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Macropod

Retired Moderator
Joined
Aug 27, 2007
Messages
3,511
Works fine for me when I simply paste the dram currency symbol (֏) from your post into Excel's number formatting pane.
 

kevanr

New Member
Joined
Nov 7, 2019
Messages
14
Works fine for me when I simply paste the dram currency symbol (֏) from your post into Excel's number formatting pane.
Thanks Paul, I agree that works when you manually post it.
I'm referring to when I run a macro as my model is used across the world and I do not want users to have to do anything manually, they must simply run the macro and VBA must sort it.
However I'm getting the problem of my VBA code in my VBA editor changing the code to include the "?" and not the "֏" as described in my post above.
 

Macropod

Retired Moderator
Joined
Aug 27, 2007
Messages
3,511
For VBA, you can insert the character via ChrW, using its Unicode Hex value:
VBA Code:
Selection.NumberFormat = _
  "_-[$" & ChrW(&H58F) & "-hy-AM] * #,##0_ ;[Red]_-[$" & ChrW(&H58F) & "-hy-AM] * -#,##0 ;_-[$" & ChrW(&H58F) & "-hy-AM] * ""-""_ ;_-@_ "
 

kevanr

New Member
Joined
Nov 7, 2019
Messages
14
For VBA, you can insert the character via ChrW, using its Unicode Hex value:
VBA Code:
Selection.NumberFormat = _
  "_-[$" & ChrW(&H58F) & "-hy-AM] * #,##0_ ;[Red]_-[$" & ChrW(&H58F) & "-hy-AM] * -#,##0 ;_-[$" & ChrW(&H58F) & "-hy-AM] * ""-""_ ;_-@_ "
Thanks Paul - that worked perfectly, much appreciated !
 

Watch MrExcel Video

Forum statistics

Threads
1,122,263
Messages
5,595,166
Members
413,973
Latest member
leon1974mk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top