Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
cdb cdb is offline
external usenet poster
 
Posts: 62
Default Time Calculation - How long a macro takes to run

The timer will stop when it gets to 100000000 only - that is the only
criteria in the below code.

"Papa Jonah" wrote:

Tom,
This is an interesting thread. I do not understand what causes the timer to
stop except if i reaches 100000000.

What will tell it to stop?

"Tom Ogilvy" wrote:

Sub test2()

i = 1

starttime = Timer

While i < 100000000
i = i + 1
Wend

endtime = Timer
timecalc = EndTime - StartTime

MsgBox (starttime & endtime & timecalc)

End Sub

Measures the number of seconds.

(subtracting the endtime from starttime would give a negative number).

--
Regards,
Tom Ogilvy

"cdb" wrote in message
...
I am trying to add into my macro a bit of code that times how long it

takes
to execute, but I can't seem to get it right.

As a test I have been using the following code:

Sub test2()

i = 1

starttime = TimeValue(Time)

While i < 100000000
i = i + 1
Wend

endtime = TimeValue(Time)
timecalc = TimeValue(starttime) - TimeValue(endtime)

MsgBox (starttime & endtime & timecalc)

End Sub

But when I output the result (timecalc) it gives a really wierd number
(-1.85185185185233E-04). I have tried it without the TimeValue statement

too
and get the same sort of result.

Is there an easy way of substracting the start time from the end time??




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
Clearing cells takes long, long time unclemuffin Excel Discussion (Misc queries) 9 August 17th 07 02:22 AM
Loading MS Query takes a long time TonyL Excel Worksheet Functions 0 August 14th 06 08:30 AM
Save takes long time Jan Excel Discussion (Misc queries) 2 February 15th 06 06:01 PM
Excel takes long time to open Sudarshan Shirbahadurkar Excel Programming 1 June 29th 04 02:31 AM
Saving Takes long time kvenku[_6_] Excel Programming 1 May 14th 04 02:38 PM


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