Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time consumption in macros
Hi eveybody, here I am with one question:
How can I know the time which takes to Excel to execute a macro. Because I have got some loops and I want to know how long does it take in order to view if I can improve the loops or not. Probably it is a simple question which I don't know and I think it is very useful. Thanks for your time!!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time consumption in macros
At the start of your code put in the line: start_time = Now and at the end put: msgbox "Seconds elapsed: " & int((now-start_time)*86400) Col -- colofnature ------------------------------------------------------------------------ colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356 View this thread: http://www.excelforum.com/showthread...hreadid=560703 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time consumption in macros
Jon,
Here's a quick one. Sub YourSubName() Dim starttime As Double starttime = Now ....your code.... MsgBox (Format(Now - starttime, "h:mm:ss")) End Sub Mike "Jon" wrote: Hi eveybody, here I am with one question: How can I know the time which takes to Excel to execute a macro. Because I have got some loops and I want to know how long does it take in order to view if I can improve the loops or not. Probably it is a simple question which I don't know and I think it is very useful. Thanks for your time!!! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time consumption in macros
You want to use the timer something like this...
Dim lng As Long Dim sngStartTime As Single Dim sngEndTime As Single sngStartTime = Timer For lng = 1 To 1000000000 Step 1 Next lng sngEndTime = Timer MsgBox "Duration " & sngEndTime - sngStartTime -- HTH... Jim Thomlinson "Jon" wrote: Hi eveybody, here I am with one question: How can I know the time which takes to Excel to execute a macro. Because I have got some loops and I want to know how long does it take in order to view if I can improve the loops or not. Probably it is a simple question which I don't know and I think it is very useful. Thanks for your time!!! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time consumption in macros
As an example, rough and ready but should suit
Dim i As Long, j As Long Dim nTime As Double nTime = Timer For i = 1 To 10000 For j = 1 To 10000 ' Next j Next i MsgBox Timer - nTime -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jon" wrote in message ... Hi eveybody, here I am with one question: How can I know the time which takes to Excel to execute a macro. Because I have got some loops and I want to know how long does it take in order to view if I can improve the loops or not. Probably it is a simple question which I don't know and I think it is very useful. Thanks for your time!!! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time consumption in macros
Really thanks to all of you. It has been very useful.
"Bob Phillips" wrote: As an example, rough and ready but should suit Dim i As Long, j As Long Dim nTime As Double nTime = Timer For i = 1 To 10000 For j = 1 To 10000 ' Next j Next i MsgBox Timer - nTime -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jon" wrote in message ... Hi eveybody, here I am with one question: How can I know the time which takes to Excel to execute a macro. Because I have got some loops and I want to know how long does it take in order to view if I can improve the loops or not. Probably it is a simple question which I don't know and I think it is very useful. Thanks for your time!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Charting time consumption | Excel Discussion (Misc queries) | |||
What is the formula to calculate electricity consumption | Excel Worksheet Functions | |||
What is the formula to calculate time & power consumption | Excel Discussion (Misc queries) | |||
Fule consumption | Excel Discussion (Misc queries) | |||
Consumption function | Excel Discussion (Misc queries) |