View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default Custom Number Formats in Code

Your code worked fine for me also.
Does this small code help in debugging.
It returns the current format, what it should be, and what it was changed
to.

Sub Test()
Const s As String = "#,##0_);(#,##0)"

Debug.Print Range("A1").NumberFormat
Range("A1").NumberFormat = s

Debug.Print s
Debug.Print Range("A1").NumberFormat
End Sub

For me, it returned:

General
#,##0_);(#,##0)
#,##0_);(#,##0)

--
HTH :)
Dana DeLouis
Windows XP & Office 2003


"veryeavy" wrote in message
...
Hi,

Hope this qualifies as "programming".

the following macro:

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

does not do the job I was hoping.

On examination the format that is applied is:

#,##0;-#,##0

any way to get my preferred format to "take"?

TIA, Matt