Formating of Numbers

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Hello,
Hope someone can help. I have a worksheet I use to generate a chart using
VBA code. I then want to label a series, for example, the average on the
chart using the number format on worksheet.

To find the number format, I use:

Formattype = cells(1,1).numberformat

Then I use something like

Avg. = format(x, formattype) to find the avg to put on the chart.

I get weird number formats like $1.28_ when I just use currency.

Any suggestions?

Thanks.

Bill
 
I think the easiest for you is to use the TEXT() worksheet function, instead
of the Format$() function, like this

Avg = Application.Text(x, formattype)
 
Thanks. Works like a charm.


Juan Pablo González said:
I think the easiest for you is to use the TEXT() worksheet function,
instead
of the Format$() function, like this

Avg = Application.Text(x, formattype)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top