LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Can time be measured to milliseconds?

I know you can pause a macro for a certain number of milliseconds using

Public Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
Option Private Module

but I want to know the time between a certain number of iterations. The
code runs too fast per iteration to calculate using seconds, and I can't seem
to figure out how to measure more precisely. My code is as follows:

Function timeRemaining(lastTime, curRow, endRow, cycles)

lastTime = CDbl(lastTime)

Dim timeNow As Double
Dim cyclesLeft As Long
timeNow = CDbl(Time)
cyclesLeft = Int((endRow - curRow) / cycles)

timeRemaining = format(CDate((timeNow - lastTime) * cyclesLeft), "h:mm:ss")

lastTime = CDbl(Time)

End Function

Thanks for your help,
Pflugs
 
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
Adding and Subtracting a Time with MilliSeconds carl Excel Worksheet Functions 8 April 5th 23 02:41 PM
Time-scale chart measured in hours & minutes John Charts and Charting in Excel 7 May 23rd 10 07:20 PM
charting time series with milliseconds with scatter ecoulson Charts and Charting in Excel 2 December 2nd 09 11:58 PM
Comparing time values which have milliseconds in them e.g 10:20:30 Jon Stickings Excel Discussion (Misc queries) 5 October 5th 06 02:03 PM
Grab Time with milliseconds included in VBA Erick Excel Programming 4 October 28th 04 10:42 AM


All times are GMT +1. The time now is 01:06 AM.

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"