Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Counting how long a Macro takes to run

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Counting how long a Macro takes to run

dim sngStart as Single

sngStart = Now
- your code

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

--
Regards,
Tom Ogilvy


"Diane Alsing" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Counting how long a Macro takes to run

As always - fantastic! Thanks.

"Tom Ogilvy" wrote:

dim sngStart as Single

sngStart = Now
- your code

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

--
Regards,
Tom Ogilvy


"Diane Alsing" wrote in message
...
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




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
VLookup takes too long DTTODGG Excel Worksheet Functions 4 March 20th 08 09:57 PM
Clearing cells takes long, long time unclemuffin Excel Discussion (Misc queries) 9 August 17th 07 02:22 AM
PasteSpecial takes too long Ramil[_2_] Excel Programming 0 January 19th 04 05:01 PM


All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"