Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Create a time stamp from a date and vv


Help!
I want to write a udf in vba as function d2tstamp() and a function
tspam2d() which does just that.
I have it working combining data from different cells and letting excel
do the calculation but cannot get it to work in vba

Date to Timestamp:
Date: 12-12-2005
X = 38698.00 serial value for 12-12-2005
Y = 25569.00 serial value for 1-1-1970

Calculation: (X - Y) * 24 * 60 * 60 = 1134345600

Timestamp to Date:
Calculation: (Timestamp / 24 * 60 *60) + Y = 12-12-2005

All this looks perfect but when I put it in a vba code and run it it
doesn't want to work.
Does anybody have a sample code for me? Two sample codes?




--
hhalle

Male
------------------------------------------------------------------------
hhalle's Profile: http://www.excelforum.com/member.php...o&userid=20829
View this thread: http://www.excelforum.com/showthread...hreadid=495634

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Create a time stamp from a date and vv

This might be helpful:

http://www.mcgimpsey.com/excel/udfs/unixtoxltime.html

When you say "it doesn't want to work", what do you mean? Do you get the
wrong value? no value? an error? a run-time error? a crash?



In article ,
hhalle wrote:

Help!
I want to write a udf in vba as function d2tstamp() and a function
tspam2d() which does just that.
I have it working combining data from different cells and letting excel
do the calculation but cannot get it to work in vba

Date to Timestamp:
Date: 12-12-2005
X = 38698.00 serial value for 12-12-2005
Y = 25569.00 serial value for 1-1-1970

Calculation: (X - Y) * 24 * 60 * 60 = 1134345600

Timestamp to Date:
Calculation: (Timestamp / 24 * 60 *60) + Y = 12-12-2005

All this looks perfect but when I put it in a vba code and run it it
doesn't want to work.
Does anybody have a sample code for me? Two sample codes?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Create a time stamp from a date and vv


Hi,

When I say it wont work is that I gat either a #VALUE! error of a
#NUMBER! error

When taking it step by step and including msgboxes to show the
intermediary results those are OK but the final returns the error.

Thanks for reading

Hans


--
hhalle

Male
------------------------------------------------------------------------
hhalle's Profile: http://www.excelforum.com/member.php...o&userid=20829
View this thread: http://www.excelforum.com/showthread...hreadid=495634

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-time stamp Daniel Excel Discussion (Misc queries) 3 September 7th 09 10:58 AM
Date-Time Stamp [email protected] Excel Discussion (Misc queries) 1 September 27th 06 02:37 PM
Create a button that will date stamp todays date in a cell Tom Meacham Excel Discussion (Misc queries) 3 January 11th 06 01:08 AM
date/time stamp Jan Excel Worksheet Functions 7 July 14th 05 01:04 PM
Date time stamp Chip Pearson Excel Programming 0 March 1st 04 04:14 PM


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