Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Show Milliseconds

Maybe...
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

Option Explicit
Private Declare Function timeGetTime Lib "winmm.dll" () As Long

Sub test()
Dim ntime As String
Dim counter As Integer
Dim lngStart As Long
Dim lngTicks As Single

counter = 0
'milliseconds
lngStart = timeGetTime

Do While counter < 5
lngTicks = (timeGetTime - lngStart) / 1000
ntime = Format$(lngTicks, "00.000")
Range("e7").Value = ntime
counter = counter + 1

MsgBox ntime
Loop
End Sub
'-----------------


"Ndel40"
wrote in message
I am trying to build a program to show elapsed time and I want to display the
time in "hh:mm:ss.000" format (the worksheet cell is formated as indicated).
However, I can't get milliseconds to change... always stays at 000.
Here is a test module I am using to try and get the right format... any help
would be appreciated.

Sub test()
Dim ntime As Date
Dim counter As Integer
counter = 0
Do While counter < 5
ntime = Time
Range("e7").Value = Format(ntime, "hh:mm:ss.000")
counter = counter + 1
MsgBox Format(ntime, "hh:mm:ss.000")
Loop
End Sub
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
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
Milliseconds in a Pivot Table Ryan Excel Discussion (Misc queries) 2 April 6th 06 11:09 PM
Milliseconds in Excel dhg4 Excel Programming 3 April 12th 05 08:19 PM
Milliseconds In VB ccdubs Excel Programming 1 February 26th 04 11:20 PM


All times are GMT +1. The time now is 08:02 AM.

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"