strange

  • Thread starter Thread starter WhytheQ
  • Start date Start date
W

WhytheQ

Put 20 in range B2 and then try this in the immediate window:

ActiveSheet.range("B2").NumberFormat = "$#,##0.00_ ;[Red]-$#,##0.00"

Why does it go to sterling?!!

Regards
Jason.
 
Put 20 in range B2 and then try this in the immediate window:

ActiveSheet.range("B2").NumberFormat = "$#,##0.00_ ;[Red]-$#,##0.00"

Why does it go to sterling?!!

Regards
Jason.


I guess the $ character has some special meaning in this context.
It seems it is the way of inserting the currency that is currently set
in the user preferences. And that may be dollars or may not be
dollars.

If you change your command to the following:

ActiveSheet.range("B2").NumberFormat = "\$#,##0.00_ ;[Red]-\$#,##0.00"

i.e. with a \ character just before the $ character (in two places),
the result becomes what you expect.

Hope this helps / Lars-Åke
 
Back
Top