TIME OF A MACRO-RUN

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
Is there a possibility that when a macro start via a button and during the time of running I get a display who show me the running-time in seconds?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
could you set a variable (time1) = to now() at the begining and at the end subtract time1 from now() as the last statement and put that in a cell? or were you looking for a pop-up box or something?
 
Upvote 0
do you want a progress bar?
or do you want a value returned at the end of the macro indicating the procedure time?
 
Upvote 0
[Function]
Measure Elapsed time for code to perform it's operations.

[Method]
Insert code to measure in the middle of this procedure

Code:
Sub ShowElapsedTime()
Start = Timer ' Set start time.
    
  ' PLACE CODE YOU WANT TIMED HERE
    
Finish = Timer ' Set end time.
TotalTime = Finish - Start
MsgBox ("Elapsed Time " & TotalTime & " Seconds")
End Sub

OR A SLIMMED DOWN VERSION
Code:
Sub ShowElapsedTime2()
Start = Timer ' Set start time.
    
  ' PLACE CODE YOU WANT TIMED HERE
    
MsgBox ("Elapsed Time " & Timer - Start & " Seconds")
End Sub

_________________
<font size=-1>NOTE:</font.<font size=-1> (Testing performed on Win2K utilizing Office 2000. Solutions may need tweaking for other versions.)</font><font size=+1><font color="blue">Adieu,<font color="red">N<font color="blue">imrod</font
This message was edited by Nimrod on 2002-06-18 17:28
 
Upvote 0
On 2002-06-18 17:25, Nimrod wrote:
[Function]
Measure Elapsed time for code to perform it's operations.

[Method]
Insert code to measure in the middle of this procedure

Code:
Sub ShowElapsedTime()
Start = Timer ' Set start time.
    
  ' PLACE CODE YOU WANT TIMED HERE
    
Finish = Timer ' Set end time.
TotalTime = Finish - Start
MsgBox ("Elapsed Time " & TotalTime & " Seconds")
End Sub

OR A SLIMMED DOWN VERSION
Code:
Sub ShowElapsedTime2()
Start = Timer ' Set start time.
    
  ' PLACE CODE YOU WANT TIMED HERE
    
MsgBox ("Elapsed Time " & Timer - Start & " Seconds")
End Sub

_________________
<font size=-1>NOTE:</font.<font size=-1> (Testing performed on Win2K utilizing Office 2000. Solutions may need tweaking for other versions.)</font><font size=+1><font color="blue">Adieu,<font color="red">N<font color="blue">imrod</font
This message was edited by Nimrod on 2002-06-18 17:28
Thanks Nimrod,it works fine.
Still a little question: can I also see the evolution of counting ths seconds?Now I see only the total of seconds at the end of running.
It would be fine if a user can follow the situation.
Many thanks in advance
 
Upvote 0

Forum statistics

Threads
1,215,431
Messages
6,124,855
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top