time how long a macro takes

shadow12345

Well-known Member
Joined
May 10, 2004
Messages
1,238
I would like to time how long a macro takes to complete and use debug print at certain points in the code so i can have a note of how long each section is taking.

any ideas?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
Sure.
Try putting this line where you want to start timing:
A = Time
then your code and this where you want to stop
B = Time.

And show it however you like. (ie.) MsgBox ("Run time = " & A - B)

Hope it helps.
 

Blade Hunter

Well-known Member
Joined
Mar 13, 2008
Messages
3,147
Sure.
Try putting this line where you want to start timing:
A = Time
then your code and this where you want to stop
B = Time.

And show it however you like. (ie.) MsgBox ("Run time = " & A - B)

Hope it helps.

B - A not A - B

;)
 

shadow12345

Well-known Member
Joined
May 10, 2004
Messages
1,238
indeed.... see its not as hard as i thought then.

That should be enough

cheers.
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
YES! YES!... Blade Hunter's right!
B - A not A - B

Good eye man.
Thanks for keeping me honest!
 

Watch MrExcel Video

Forum statistics

Threads
1,133,643
Messages
5,660,044
Members
418,544
Latest member
Stefan Braem

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
Top