Testing the speed of sections of VBA code?

GBagley

Board Regular
Joined
Feb 8, 2011
Messages
84
Anyone have a great way of testing the speed of certain sections of VBA code? I have a program that takes some time and goes through a ton of loops. I'm interesting in testing each section of the code to see which parts take the longest to run through. Which lines/formulas take the longest. For example, if my code takes 30 minutes to run in full, and one particular section accounts for 90% of that time, then I would want to focus in on improving just that part. I know I could have the code print times after every line, but it's already a lengthy macro as is, and it seems like there must be a better way to do a speed analysis?
 
Are you sure testing individual sections of the code will help you identify what's slowing things down?

One thing I'm wondering about is Application.ScreenUpdating and userforms.

Perhaps somehow, and I don't actually know if it's possible, showing userforms is 'interfering' with you turning off screen updating?
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
If you do not want to post your code, and it does sound large, maybe at the least describe what your code is doing, as well as its original intent and scope.
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,310
Members
452,906
Latest member
phanmemchatdakenhupviral

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