ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Evaluate time spent on macro running (https://www.excelbanter.com/excel-programming/373306-evaluate-time-spent-macro-running.html)

Morris[_2_]

Evaluate time spent on macro running
 
I was thinking of retrieving the time at the beginning of the macro, eg
in 10:31:02 converted to seconds (=37802 or sth) and then the time of
"seconds" at the end. Then subtract it and voila - convert it to
minutes and seconds (the macro runs for about 2-5 mins.

Is there any quick way to do that? Or is there a smarter way?

Cheers


Bob Phillips

Evaluate time spent on macro running
 
Sub RunTimer()
Dim nTime As Double
Dim i As Long, j As Long

nTime = Timer
For i = 1 To 1000000
For j = 1 To 100
Next j
Next i

MsgBox Format((Timer - nTime), "0.0 ""seconds""")
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Morris" wrote in message
ups.com...
I was thinking of retrieving the time at the beginning of the macro, eg
in 10:31:02 converted to seconds (=37802 or sth) and then the time of
"seconds" at the end. Then subtract it and voila - convert it to
minutes and seconds (the macro runs for about 2-5 mins.

Is there any quick way to do that? Or is there a smarter way?

Cheers





All times are GMT +1. The time now is 12:11 AM.

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