Onthe Fly Changes

Every once in a while your code will halt because of an error or a breakpoint. The VBA Editor will display the problem line or breakpoint line with an arrow pointing to it. You may discover the problem on that line, make the appropriate changes, and find that the line executes correctly. You can test this simply by pressing the F8 key and stepping through that line of code. If you realize that the problem is several lines before the current location, you can make the correction and easily restart the code from a different location. Just click on the original arrow (pointer) and drag it to the line where you want to start executing the code.

Be aware that depending on what code was executed, you may not get valid results, particularly if it is dependent on earlier code or values. So if you think you've corrected the problem but it still isn't displaying the expected values, it would be prudent to rerun the entire module or function.

Also, code changes during execution may not always be saved when the program ends. Although all the scenarios that might trigger that can't be identified, you can expect it to happen if the code causes the application to shut down. The logic is that you would not want to save modifications that caused the application to crash. But because it can be frustrating to lose other, desirable modifications, it's prudent to save your changes as you go, as usual.

Was this article helpful?

0 0

Post a comment