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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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.
 
Upvote 0
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

;)
 
Upvote 0
YES! YES!... Blade Hunter's right!
B - A not A - B

Good eye man.
Thanks for keeping me honest!
 
Upvote 0

Forum statistics

Threads
1,214,542
Messages
6,120,116
Members
448,945
Latest member
Vmanchoppy

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