View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default more newbie help on my significant figures function...

On Mon, 30 Aug 2004 01:36:43 GMT, James Bond wrote:

So I was thinking one way to do this would be to have my VBA function
determine if zeros need to be added and then change the formatting of the
active cell on the fly to accomodate that number of decimal places. Now
I don't really know exactly how to make all that happen yet, but that is
the direction I am heading.


A function cannot change the formatting of the cell.

Two possibilities:

1. Output a text string with the necessary formatting.
2. Use an event macro, probably the 'calculate' one to adjust the formatting
after your UDF has done it's work. You'd need to be able to define the range
in which you might have the results, for this to work, unless you want to check
every cell in the worksheet for your formula each time you do a calculation.



--ron