It's easy to set a breakpoint when debugging VBA, but how about a "startpoint" or a "skippoint"?
I'm debugging a subroutine in my VBA code. I want to ignore the first half and just run the second half. So, is there a way to set a 'startpoint'?
Also, is there an easy way to ignore a specific line of code other than commenting?
If not, I'll just continue commenting out all the code I don't want run. The problem with this, of course, is that I 开发者_开发知识库have to remember to uncomment the critical code before I send it on to Production.
Why not just put the breakpoint at the begining of the the second half of the subroutine? Also, I believe clicking the "run" button (green right-pointing arrow) should run and then stop the app at the next breakpoint, thus saving you from stepping through the code between breakpoints. There's also a "Run-to-cursor" feature (Ctrl-F8) which I've never used, but it's worth a try (I suspect it executes up to wherever you place the cursor). ;)
Is it just one routine?
Would a GoTo Statement work for you in this case:
Sub DoTheMagic()
Dim vars as whatever
GoTo TheFunStuff
'The impertinent code here
TheFunSuff:
'The code to debug here
End Sub
You'd have to remember to take that goto statement out before you went to production. A annoying messagebox would remind you do that.
精彩评论