View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default user defined functions format

A function can not change the format of a cell. That is true for UDF's and
built in functons. Functions return values to the cells they are in. That
being said you could use a simple custom format something like this one...

[<20]0.0 ul;[2000] #.0," ml";General

Right click the cell and select Format Cell... - Number - Custom and add
that format.
--
HTH...

Jim Thomlinson


"df_newtovba" wrote:

I am attempting to use a user-defined function to work on a cell value and
change that cell value's format. IE if A1<20 format "0.00 uL" or if A12000
divide by 1000 then format "0.0 mL", and so on...
My problem is that I create a circular reference because the cell to change
is the cell the formula would be in.
I did have a multi-level if statement in A1, but was hoping that a function
in VBA would be easier.