ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro running time (https://www.excelbanter.com/excel-programming/327968-macro-running-time.html)

Pradip Jain

Macro running time
 
I want to check the time (in seconds) which my macro takes to run.
what code can be used.

thanks
pradip

Bob Phillips[_6_]

Macro running time
 
AT the start

nTimer = Timer
... your code
Debug.Print Timer - nTimer

will give you an indicative answer, it is not absolute because there is so
much else going on.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Pradip Jain" wrote in message
...
I want to check the time (in seconds) which my macro takes to run.
what code can be used.

thanks
pradip




Tom Ogilvy

Macro running time
 
Sub TimeMyMacro()
Dim sngStart as Single, sngEnd as Single
sngStart = Timer
' call you macro
sngEnd = Timer

msgbox "It took " & format(sngEnd - sngStart,"0") & " seconds"
End Sub

The resolution of Timer is about 1 second.

For more resolution, see the techniques in this article.

http://support.microsoft.com/support.../q172/3/38.asp
HOWTO: Use QueryPerformanceCounter to Time Code

--
Regards,
Tom Ogilvy
"Pradip Jain" wrote in message
...
I want to check the time (in seconds) which my macro takes to run.
what code can be used.

thanks
pradip





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

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