VBA Breakpoint changing calculation results

tsi

New Member
Joined
Mar 15, 2012
Messages
2
I have an excel macro. When I run the macro without a breakpoint, the spreadsheet calculates slightly different values than when I run it with the breakpoint. Unfortunately, when the macro is run with the breakpoint, I get the correct values.

Any ideas on what is happening?

Mike
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Derek,

Thanks. I've run into this problem several times in the past 5 years and have become thoroughly frustrated when the macro executed properly when I did it in debug mode, but failed when I ran it normally.

I even inserted MsgBox's in an attempt to "pause" the macro similar to a breakpoint, but it did not affect the outcome. The pause solved the issue, and will save me a lot of future headaches.

Mike
 
Upvote 0
Yes, I would expect a message-box to also cause the calculating to 'pause' - as would a VBA 'wait' instruction.
The best solution was, as given, to loop with the all-important "Do Events" within the loop.
 
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,327
Members
451,637
Latest member
hvp2262

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