Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming, microsoft.public.excel.worksheet.functions,microsoft.public.office.developer.automation, microsoft.public.office.developer.com.add_ins
external usenet poster
 
Posts: 8,856
Default UDF that returns a date

The UDF should return a number to the cell, which can be formatted as
a date to suit your requirements. The number is an integer measuring
the number of elapsed days, with 1st Jan 1900 = Day 1. Excel assumes
(incorrectly) that 1900 was a leap year, so you need to take this into
account. The serial value for today's date (17th Jan 2008) is 39464.

Hope this helps.

Pete

On Jan 17, 11:31*pm, ep wrote:
Hi all,

I have a c# udf accessed as an automation add-in that needs to return dates
to Excel. I know I can't manipulate the cell's NumberFormat from within the
UDF, but is there a way to return a value that will be formatted in Excel as
a date? It seems any string value I return will default to general. Let me
know if any other info would help.

thanks


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
Date returns always returns: 00 January 1900 ArcticWolf Excel Worksheet Functions 2 September 11th 08 12:31 PM
UDF that returns a date ep Excel Worksheet Functions 5 January 19th 08 10:24 AM
UDF that returns a date ep Excel Programming 0 January 18th 08 12:25 AM
Strange? VBA code returns wrong date format (not a date) zzxxcc Excel Programming 8 October 12th 07 09:13 AM
Date+ returns #Num kit Excel Worksheet Functions 7 October 23rd 05 06:57 PM


All times are GMT +1. The time now is 11:16 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"