ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   NumberFormat (https://www.excelbanter.com/excel-programming/419340-numberformat.html)

TSW632

NumberFormat
 
Can anyone tell me how to change this code for the NumberFormat, such
that with any of the various currencies, the display will appear with
the currency symbol on the far left of the cell, the resulting figure
is displayed to the far right of the cell, no decimal places are shown
(think I
have that part solved), and zero's are displayed only as dashes?
This
is done ordinarily in the worksheet just by choosing Accounting
format
and checking the appropriate boxes.. I tried using that string :

_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)


without the $, so that line of code looks like so:


Me.Range("F49:AF49").NumberFormat
= Mid$(cv, 5, 1) & "_(* #,##0_);_(* (#,##0);_(* " - "_);_(@_)"


I imagine it's simple, but it is beyond me for the moment.

Thanks,

Troy

ShaneDevenshire

NumberFormat
 
Hi,

The easiest way to do this is to turn the recorder on and record the Format,
Cells command. The codes you are entering are the ones you would see if you
pick a format, say Currency 2 decimals and then click the Custom category
before exiting the dialog box.

When you want the currency symbol on the far left, the number format is not
Currency but Accounting.

Selection.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($*
""-""??_);_(@_)"

If this helps, please click the Yes button.
--
Thanks,
Shane Devenshire


"TSW632" wrote:

Can anyone tell me how to change this code for the NumberFormat, such
that with any of the various currencies, the display will appear with
the currency symbol on the far left of the cell, the resulting figure
is displayed to the far right of the cell, no decimal places are shown
(think I
have that part solved), and zero's are displayed only as dashes?
This
is done ordinarily in the worksheet just by choosing Accounting
format
and checking the appropriate boxes.. I tried using that string :

_($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)


without the $, so that line of code looks like so:


Me.Range("F49:AF49").NumberFormat
= Mid$(cv, 5, 1) & "_(* #,##0_);_(* (#,##0);_(* " - "_);_(@_)"


I imagine it's simple, but it is beyond me for the moment.

Thanks,

Troy



All times are GMT +1. The time now is 03:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com