View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Stepping through gives different result than running

Try using Debug.Print in your code to "print" Immediate window what is
going on as your code runs. Example
If SomeCondition Then
Debug.Print "SomeCondition = " & YourCell
'Rest of your Code
End if

You can do this at all the calculation points along the way if needed,
I put the Text of the if statement in there so I can see what data is
being returned in the immediate window, otherwise you only get the
values you ask for.

Charles Chickering

Gregg Roberts wrote:
I have about 40 pages worth of code that checks a collection of data files
for various complex exception conditions. It is giving a false alarm on one
of them, but only when I let it run. When I step through the code as it
processes the data row that gets flagged as an error when the code runs
"freely", that data row does not get flagged.

How can I debug the code when it doesn't work the same way when I'm watching
it as when I'm not watching it?

Gregg Roberts