View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
future_vba_expert future_vba_expert is offline
external usenet poster
 
Posts: 26
Default Number format in a Macro

DeWayne,

If you add a third parameter, that is for zero values, so add ;"-" to what
you have if you want zero to display as a hyphen. Your formatting code would
then look like this:

Selection.NumberFormat = "#,##0.0_);(#,##0.0); "-""

I think you have an extra paren in your first parameter, but maybe that is
intentional?


--
future_vba_expert


"Dewayne" wrote:

I have the following number format code in a macro which gives me what I need
except then the cell value is 0, I need it to indicate a "-" (hyphen) or just
remain blank.

Selection.NumberFormat = "#,##0.0_);(#,##0.0)"

Any help would be appreciated.
Thank you,
--
Dewayne