View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1984_] Rick Rothstein \(MVP - VB\)[_1984_] is offline
external usenet poster
 
Posts: 1
Default How to knwo the current statement

There's no automatic way to figure this out that I'm aware of. You can
do one of two things. The simplest and most reliable would be to place a
break point before the whole block of code that you are interested in and
then step through it manually to determine which path the code takes.


Another technique that I like to use is to place Debug.Print statements at
the key points in the execution path having them print out (to the Immediate
window) location and and variable information. As an example....

Debug.Print "I'm in MySub; MyVariable = " & MyVariable

These Debug.Print statements can be anywhere in your code (event procedures,
functions, etc.) allowing you to run your code to the break point and then
simply read where you have been and what any key variables were along the
way.

I usually place the Debug.Print statements flush-left so that stand out
against my indented code making them easy to find when the debugging session
is over and I want to remove them.

Rick