tags:

views:

44

answers:

2

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.

+2  A: 

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). ;)

FrustratedWithFormsDesigner
`Stop` can also be useful. If this='that' Then Stop
Remou
also Debug.Assert (this <> "that")
Alex K.
A: 

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.

ray023