Results 1 to 20 of 22

Thread: Displaying total runtime of Macro

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Minutes and milliseconds ?
    Surely you mean mm:ss.sss ??? minutes, seconds and milliseconds ?
    This sort of thing IS generic, we ALL use this sort of thing during testing to identify bottlenecks and find which of a few options is 'that' bit quicker.
    There is a typo in the last code you were given.

    Always check your code,
    Something is wrong if you are always getting the same result.
    Sounds like a variable NEVER being updated

    Try :-
    Sub Timed_Code() 
    Dim timet1 As Double 
    timet1 = Now 
    ' Run Your Code Here
    MsgBox "EXPECTED macro completed at " & Format$(Now, "dd/mm/yyyy h:mm:ss am/pm") & _
    vbcrlf & "The entire process took " & Format$((Now - timet1) / 86400, "h:mm:ss") & " h:mm:ss" 
    End Sub
    Each case is different and thus requires SOME manual tweaking, if you want mm:ss.sss then I'll know you up some other code.
    Last edited by unmarkedhelicopter; 12-22-2007 at 06:17 AM.
    2+2=9 ... (My Arithmetic Is Mental)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •