View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Stepping through gives different result than running

sounds like you have your code in a sheet module.

Look for references like

Range("A1")

this refers to the activesheet when stepping through your code. When
running your code, it refers to the sheet that contains the code. Put in
explicit references

activesheet.Range("A1")
or
Me.Range("A1")

so there are no assumptions as to what is referred to .

--
Regards,
Tom Ogilvy


"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