ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UDF return (https://www.excelbanter.com/excel-programming/301257-udf-return.html)

ampm[_2_]

UDF return
 
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

--
Message posted from http://www.ExcelForum.com


Nigel

UDF return
 
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


"ampm " wrote in message
...
I have a problem,

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

How can I do it?

Thanks


---
Message posted from http://www.ExcelForum.com/




Frank Kabel

UDF return
 
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

--
Regards
Frank Kabel
Frankfurt, Germany


I have a problem,

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

How can I do it?

Thanks


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 07:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com