Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How can I change the caller cell's format into "mm/dd/yyyy"?

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How can I change the caller cell's format into "mm/dd/yyyy"?

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


" wrote:

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?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change "xxx CR" and "y,yyy DB" to "+xxx" and "-yyyy" vud i Excel Worksheet Functions 6 January 31st 09 05:37 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Excel VBA to convert "dd.MM.yy" text to "dd/MM/yyyy" format date? Paul J[_2_] Excel Programming 4 July 11th 07 11:32 AM
Option Explicit and Date Format "dd mmm yyyy"? Rob van Gelder[_4_] Excel Programming 11 November 10th 04 10:13 PM
How To: Use Cell("Format") to return MMMM YYYY instead of D3 Kevin McCartney[_2_] Excel Programming 8 May 19th 04 01:34 AM


All times are GMT +1. The time now is 06:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"