UDF return

  • Thread starter Thread starter ampm
  • Start date Start date
A

ampm

I have a problem,

When my UDF return a value in a worksheet I need that the value will b
numerical value with format (like %).

How can I do it?

Thank
 
use FormatPercent to create a string representation of the numeric value.

Dim x As Double, fx As String
x = 0.1235
fx = FormatPercent(x)

You can control the number of decimal values eg

fx = FromatPercent(x,4)

Cheers
Nigel
 
Hi
I would suggest to format the target cell as percentage and just return
the correct numerical value. I wouldn't return a string as this may be
problematic in further calculations
 

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