View Single Post
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

A worksheet function cannot set a format, just return a value. You will have
to format the cell.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Dominic Olivastro" wrote in message
ervers.com...
I just wrote a function that returns a variant, instanced as either a

string
("N/A") or a date. But I noticed it appears as a number in the

spreadsheet.
So I figure I could format the cell right within the function, using:

ActiveCell.NumberFormat = "yyyy-mm-dd"

It doesn't work. When I insert after this statement, the following:
debug.print (ActiveCell.NumberFormat)

I find that it is still general. The odd thing is, if I write another
function that only sets the active cell to the proper format, it works

fine.

Any ideas?
Dom