View Single Post
  #1   Report Post  
Dominic Olivastro
 
Posts: n/a
Default Setting NumberFormat within a VBA Module

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