Run doesn;t work

Lara465

New Member
Joined
Mar 29, 2020
Messages
32
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello
So, when I go through my code step by step, it works fine, but when I hit RUN, I have to repeat some action for 5 sheets, It works fine for each sheet except the second one. It doesn't make sense to me. For the second page, it does a part of the actions but then it exits a loop earlier and then for the rest of pages it does all the actions.
Any ideas why that may be ?
Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Any time you have questions about your script.
You need to post your code here.
And explain in words with specific details what you want the script to do.
 
Upvote 0
One reason might be: the code is executing faster than Excel can handle e.g. a 2 legged race where 1 person is faster, has a bigger walking stride than the other person.

When you F8 through code, it executes each line of code before the next line executes and Excel updates accordingly.

This manual method is slower to complete than running through the macro so you don't notice the speed difference between each executed line of code and Excel responding in real time.
When you run your macro, it is executing each line of code faster than Excel can keep up, so you're resorting to F8 step throughs.

This suggests your code needs review and optimising or quicker answer is you inserting "pauses" within the code to allow Excel events to keep up with code execution.

Links with details:
- Macro works in stepping through, but not when I run it - Excel 2003
- VBA code only works when stepping through
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,417
Messages
6,124,789
Members
449,188
Latest member
Hoffk036

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