Thread: Number Format
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Aaron Aaron is offline
external usenet poster
 
Posts: 59
Default Number Format

On Dec 10, 12:37*am, Ron Rosenfeld wrote:
On Mon, 8 Dec 2008 22:24:15 -0800
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


Sorry I am new to the groups and thought after a topic was thanked it
was sort of closed and not looked at again.

I now understand my problem is that you can only follow the \ with one
character.

The g is for grams and I also would like kg for kilograms and lbf for
pounds.

I have now made the line " \k\g" for kg and it works great. I assume I
can use " \l\b\f" for pounds also but I havent tried that yet.

Thanks again everyone.

Aaron.