UDF return

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
 
N

Nigel

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
 
F

Frank Kabel

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
 
Top