Thread: Time comparison
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Time comparison

Hi,

t1=Timer( )
....
t2=Timer( )

total = t2-t1
--
Regards,
Sébastien


"Gixxer_J_97" wrote:

Hi all

I am trying to figure out what section of my code is running the longest.

how do i compare two times (ie subtract the two so that i can get a total
time run)

sub MyCode()
dim t1, t2, total
t1=time
<my code
t2=time

total=<how do i work with the time here
msgbox total
end sub

is this the correct way to do this or is there a better way?

and secondly is there a way to write one sub and have it triggered any time
that code is run, without putting a call to it in each of my functions?

basically i want to see how long each section of my code takes to run, so i
can see where the slowdowns are and possibly re-write, etc


tia!

J