Returning formatted output from a User defined function

G

Guest

Hi,
I need a user defined function to return formatted output

function userdefined(arg1, arg2) as double
userdefined = arg1/arg2
end function

I want the output as a percentage. Pls let me know the statement for that.
Thanks.
 
G

Guest

UDF's can not modify formats. A function called from within Code can act upon
any cells to change formats and whatever else that they want. When called
from a sheet however UDF's can ONLY return values to the cell that they are
in. They can not modify the values of cells that they are not in and they can
not modify the format of any cells. Just one of those rules...
 
G

Guest

Bonsoir Salman « Salem »

si j'ai bien compris voilà ce que tu cherchais

Function userdefined(arg1, arg2)
Application.Volatile
userdefined = FormatPercent(arg1 / arg2, 0)
End Function

Abed_H


"Salman" a écrit :
 
N

NickHK

You mean ?

function userdefined(arg1, arg2) as double
userdefined = arg1/arg2 * 100
end function

NickHK
 

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

Top