Thread: Number Format
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Number Format

On Mon, 8 Dec 2008 22:24:15 -0800 (PST), Aaron
wrote:

Hi,

Im using
.NumberFormat & " \g" sucessfully, but I cant use .NumberFormat & "
\kg" as excel says it cant set the number format.

Why should it care about a text inside brackets or is it limited to
just one text character? How can I make this work?

TIA

Aaron.


Gee, it sure would help if you posted in your original thread.

As best I can tell, you are formatting within VBA. And I am also assuming that
you want to display something like

123 g

As such, your format string is incorrect.

For example, if your format string was "General", then the above would resolve
to either

General \g

or
General \kg

The problem is that you can only follow a slash with a single character.

Two solutions:

..NumberFormat & "\k\g"

which resolves to General \k\g

or

..NumberFormat & """ kg""" which would resolve to

General" kg"
--ron