Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Clock how long it takes code to run?

Hello. I have several pieces of code that do the same exact thing,
but are written differently. Is there a way to measure the time it
takes for a piece of code to run so I can determine which runs
fastest? Thanks!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default Clock how long it takes code to run?

On 2 Jun 2004 12:58:25 -0700, Steph wrote:

Hello. I have several pieces of code that do the same exact thing,
but are written differently. Is there a way to measure the time it
takes for a piece of code to run so I can determine which runs
fastest? Thanks!!


Here's a simple method that works for me. It's not terribly accurate -
you get fairly significant variations depending on what else your system
is doing; best to use an average of several runs...
Dim m As Single, n As Single, o As Single
m = Timer
'your code here
n = Timer
o = n - m
MsgBox o

--
auric underscore underscore at hotmail dot com
*****
Halmark's on the line; they want their lyrics back.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Clock how long it takes code to run?

If you want a more reliable method, check out Karl Peterson's Stopwatch code
at http://www.mvps.org/vb/index2.html?tips/benchmarks.htm

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Auric__" wrote in message
...
On 2 Jun 2004 12:58:25 -0700, Steph wrote:

Hello. I have several pieces of code that do the same exact thing,
but are written differently. Is there a way to measure the time it
takes for a piece of code to run so I can determine which runs
fastest? Thanks!!


Here's a simple method that works for me. It's not terribly accurate -
you get fairly significant variations depending on what else your system
is doing; best to use an average of several runs...
Dim m As Single, n As Single, o As Single
m = Timer
'your code here
n = Timer
o = n - m
MsgBox o

--
auric underscore underscore at hotmail dot com
*****
Halmark's on the line; they want their lyrics back.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Clock how long it takes code to run?

To start with, at various points in my code I use, e.g.

[h1].Value = Time
[h2].Value = Time
[h3].Value = Time
[h4].Value = Time etc

This enables me to determine time taken for a particular piece of code to
execute. - Works for me!

Martin

Steph wrote in message
om...
Hello. I have several pieces of code that do the same exact thing,
but are written differently. Is there a way to measure the time it
takes for a piece of code to run so I can determine which runs
fastest? 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
deleting takes too long Howiek1 Excel Worksheet Functions 2 January 17th 11 12:58 PM
Autorecover takes so long Kevryl Excel Discussion (Misc queries) 0 April 1st 10 05:44 AM
Code takes to long Oggy Excel Discussion (Misc queries) 1 March 30th 08 10:56 PM
Clearing cells takes long, long time unclemuffin Excel Discussion (Misc queries) 9 August 17th 07 02:22 AM
Recalculation takes too long - help!!!! JulieD Excel Worksheet Functions 0 October 29th 04 09:39 AM


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