Counting how long a Macro takes to run

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Macro that Opens, saves & closes a directory of files (to
automatically update data links, etc). I would like to add a little piece of
code that takes note of the time the Marco Starts & Stops & displays the time
it took to run when it is completed.

I currently have code that displays the quantity of files updated.

MsgBox "Update Complete. " & Counter & " Files Updated"

I was wondering if it was possible to perhaps capture the before & after
times & just subtract them (but I know dates/times in Excel are weird so I'm
not sure how to do it)

Thank you.
Regards,
Diane
 
dim sngStart as Single

sngStart = Now
- your code

MsgBox "Update Complete. " & Counter & _
" Files Updated" & VBNewline &
" took " & format(now - sngStart,"hh:mm:ss")
 
As always - fantastic! Thanks.

Tom Ogilvy said:
dim sngStart as Single

sngStart = Now
- your code

MsgBox "Update Complete. " & Counter & _
" Files Updated" & VBNewline &
" took " & format(now - sngStart,"hh:mm:ss")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top