Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Milliseconds in Excel

Can Excel handle milliseconds? Or is the only way to do it as a string?
The code below chokes on cDate(full_time)

full_time = Format(hr, "00") & ":" & Format(mn, "00") & ":" &
Format(sc, "00")
full_time = full_time & "." & Format(ml, "000")
Worksheets(2).Cells(ind, 1) = cDate(full_time)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Milliseconds in Excel


"dhg4" wrote in message
ups.com...
Can Excel handle milliseconds? Or is the only way to do it as a string?
The code below chokes on cDate(full_time)

full_time = Format(hr, "00") & ":" & Format(mn, "00") & ":" &
Format(sc, "00")
full_time = full_time & "." & Format(ml, "000")
Worksheets(2).Cells(ind, 1) = cDate(full_time)


You can use the GetTickCount function from the Windows API. You have to
declare it as:

Option Explicit
Declare Function GetTickCount Lib "kernel32" () As Long

/Fredrik


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Milliseconds in Excel

I don't think it will work the way you are doing it, but this worked:

Sub BB()
Dim dt As Double
hr = 10
Min = 10
sec = 10
ml = 0.001
dt = hr / 24 + Min / (24 * 60) _
+ (sec + ml) / (24# * 60# * 60#)
ActiveCell.Value = dt
ActiveCell.NumberFormat = "hh:mm:ss.000"
Debug.Print ActiveCell.Text
End Sub

--
Regards,
Tom Ogilvy

"dhg4" wrote in message
ups.com...
Can Excel handle milliseconds? Or is the only way to do it as a string?
The code below chokes on cDate(full_time)

full_time = Format(hr, "00") & ":" & Format(mn, "00") & ":" &
Format(sc, "00")
full_time = full_time & "." & Format(ml, "000")
Worksheets(2).Cells(ind, 1) = cDate(full_time)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Milliseconds in Excel

Tom,
Thanks a lot. That did the trick.
I really appreciate it!
David

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
hh:mm:ss AND Milliseconds? Lainey25 Excel Discussion (Misc queries) 5 May 6th 08 05:32 PM
Working With Times / Milliseconds Carl Excel Worksheet Functions 1 December 7th 06 05:03 AM
Excel function to find difference of timestamps in milliseconds? Srikanth Excel Discussion (Misc queries) 1 July 6th 06 08:02 AM
Milliseconds in a Pivot Table Ryan Excel Discussion (Misc queries) 2 April 6th 06 11:09 PM
Milliseconds In VB ccdubs Excel Programming 1 February 26th 04 11:20 PM


All times are GMT +1. The time now is 09:13 PM.

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

About Us

"It's about Microsoft Excel"