0
votes

In my Excel for a cell I check the condition and wants to apply the currency format,

  1. USD (For Example : USD 44.345)
  2. EUR (For Example : EUR 11.000)

I tried to apply like below:

MyRange.FormatConditions(1).NumberFormat = "##0.0###"

I'm able to add text after the value like below:

MyRange.FormatConditions(1).NumberFormat = "##0.0###"" My text"""

But I need to add currency text before the price.

Please help me to acheive the above currency format.

1
How to prepend the text USD or EUR in the value ? - GK_
I want to add the text before value.. Not after ? - GK_
"USD" ##0.0###? - BigBen
I tried adding all possibilitied (before, inside), its giving error only - GK_
Don't you want to use "[$EUR] #,##0.00" and "[$USD] #,##0.00"? - JvdV

1 Answers

0
votes

You can do it by escaping individual characters. That also means that you could set it dynamically i guess

ActiveSheet.Range("a1:b2").NumberFormat = "\U\S\D #,##0.00"

for example: I experimented a bit - see no logic in this, but

ActiveSheet.Range("a1:b2").NumberFormat = "\EUR #,##0.00"

works and

ActiveSheet.Range("a1:b2").NumberFormat = "\USD #,##0.00"

throws an error