How to step through code

G

Guest

Quick question,
I have seen this solution noted many times, but how do I do this? I assume
it also works on code in an event (like ONCLICK).

Set a breakpoint on the Function "something". When you step
through the code line by line, does it work as you'd expect?

My method is to put msgbox "Step1" everywhere.
 
K

Ken Snell \(MVP\)

Set a breakpoint on the first line of the code procedure. Then step through
the code using the F8 key.
 
J

John Vinson

Quick question,
I have seen this solution noted many times, but how do I do this? I assume
it also works on code in an event (like ONCLICK).

Set a breakpoint on the Function "something". When you step
through the code line by line, does it work as you'd expect?

My method is to put msgbox "Step1" everywhere.

eeep!

MUCH harder than needed - you don't need to edit your code at all.

Open the VBA editor; edit the routine you wish to debug. With the
mouse, click in the vertical bar (looks like a scrollbar but isn't) on
the left side of the edit window. You'll get a red-brown circular dot
as a breakpoint.

When you run the code you can use the Debug... menu options to step
through - or (of course) their keyboard shortcuts. F8 singlesteps; see
the Debug dropdown for the other options.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top