How can I change the caller cell's format into "mm/dd/yyyy"?

Y

yajiv.vijay

I have a user defined function which returns a date. I want to set the
caller cell's format to "Date" before placing my result. How can i do
that?
I tried with this code but i am getting a number...If i change the
cell format into date manully, it works fine.

Function ReturnDate() as date
ReturnDate="2/11/2008"
range(application.caller.address).numberformat="mm/dd/yyyy"
End Function

Inside sheet...
=ReturnDate()

where did i go wrong?
 
G

Gary''s Student

A UDF cannot change a cell's format. Just set the format in the worksheet in
the usual way.
 

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