Thread: Time Sub
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Paul Black Paul Black is offline
external usenet poster
 
Posts: 394
Default Time Sub

Thanks Joel,

One final point please. Is there any way to only get the actual time
elapsed please. What I mean by that is if the Sub only takes 9 minutes
& 24 seconds to run, then the time will only show the minutes and the
seconds and exclude the hours part. This also applies if it only took
seconds to run.

Thanks in Advance.
All the Best.
Paul

On Aug 13, 1:48 pm, Joel wrote:
Sub mytime()

Start = Now - 5
Timeelapse = (Timer - Start) / 24 / 60 / 60

timestring = "Processing Time " & Format(Timeelapse, "hh") & " hours " & _
Format(Timeelapse, "mm") & " minutes " & Format(Timeelapse, "ss") & _
" seconds"

End Sub



"Paul Black" wrote:
Hi everyone,


How can I get the total processing time of a Sub to appear in a
message box once the Sub has finished please.
I have got ...


Dim start As Double
Start = Timer


.... so far but want it to produce the processing time in the format x
hours y minutes & z seconds.
I know it will be something like Timer - Start but then I am at a
loss.
Perhaps something like ...


"Processing Time " & Format(Timer - Start) / 24 / 60 / 60) = x hours y
minutes & z seconds)


Thanks in Advance.
All the Best.
Paul- Hide quoted text -


- Show quoted text -