ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Timed Operation (https://www.excelbanter.com/excel-programming/315082-timed-operation.html)

Todd huttenstine

Timed Operation
 
hey guys

I have a code that takes about 1 minute 40 seconds to
run. Is there anyway to time how long this operation
takes? At the very end of my code I want to put a message
box stating how long it took the code from start until the
point I want the message to appear.


Thanks

Todd Huttenstine

Chip Pearson

Timed Operation
 
Todd,

Write your code similar to the following:

Dim StartTime As Double
Dim EndTime As Double
StartTime = Now
'
' your code here
'
EndTime = Now
Msgbox "Code took: " & Format(EndTime - StartTime,"hh:mm:ss") & "
to run"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Todd Huttenstine" wrote in
message ...
hey guys

I have a code that takes about 1 minute 40 seconds to
run. Is there anyway to time how long this operation
takes? At the very end of my code I want to put a message
box stating how long it took the code from start until the
point I want the message to appear.


Thanks

Todd Huttenstine




Tom Ogilvy

Timed Operation
 
Dim strt as Single
strt = Timer

.. . .

msgbox "took " & Timer - strt & " seconds"

--
Regards,
Tom Ogilvy

"Todd Huttenstine" wrote in message
...
hey guys

I have a code that takes about 1 minute 40 seconds to
run. Is there anyway to time how long this operation
takes? At the very end of my code I want to put a message
box stating how long it took the code from start until the
point I want the message to appear.


Thanks

Todd Huttenstine





All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com