PC Review


Reply
Thread Tools Rate Thread

Different results when running macro vs stepping into macro

 
 
Ken Steinhoff
Guest
Posts: n/a
 
      20th Sep 2007
My boss built a macro which returns different results when run than
when he steps through it.

Before I get specific about what the macro does (since I don't have it
in front of me), I thought I'd ask the general question about what
might cause that to happen.

If the macro works when executed manually step-by-step, I would think
it should work the same way when launched.

Ideas? Comments?

--
Ken Steinhoff
Telecommunications Manager
Palm Beach Newspapers, Inc.
(E-Mail Removed)
-----------------
www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
Access your favorite newsgroups from home or on the road
-----------------
 
Reply With Quote
 
 
 
 
Marcus =?iso-8859-15?Q?Sch=F6neborn?=
Guest
Posts: n/a
 
      20th Sep 2007
»Ken Steinhoff« <(E-Mail Removed)> wrote:
> My boss built a macro which returns different results when run than
> when he steps through it.
>
> Before I get specific about what the macro does (since I don't have it
> in front of me), I thought I'd ask the general question about what
> might cause that to happen.
>
> If the macro works when executed manually step-by-step, I would think
> it should work the same way when launched.


It may access the current time multiple times:

t1 = time() - value1 ' age of value1
t2 = time() - value2 ' age of value2
dt = t2 - t1 ' age difference

When single stepping, dt can be LARGER than value1 - value2, although
it's equal when running at once.
 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      20th Sep 2007
just a thought. are you changing sheets to check results as you step through the
macro? i would make sure the ranges are fully qualified. maybe someone else will
have a better idea.

--


Gary


"Ken Steinhoff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> My boss built a macro which returns different results when run than
> when he steps through it.
>
> Before I get specific about what the macro does (since I don't have it
> in front of me), I thought I'd ask the general question about what
> might cause that to happen.
>
> If the macro works when executed manually step-by-step, I would think
> it should work the same way when launched.
>
> Ideas? Comments?
>
> --
> Ken Steinhoff
> Telecommunications Manager
> Palm Beach Newspapers, Inc.
> (E-Mail Removed)
> -----------------
> www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
> Access your favorite newsgroups from home or on the road
> -----------------



 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      20th Sep 2007
Just a guess, but if the macro depends on a Selection(s), it may be that
when your boss starts the step-through the Selection works, but not when
run from the menu.

In article <(E-Mail Removed)>,
Ken Steinhoff <(E-Mail Removed)> wrote:

> My boss built a macro which returns different results when run than
> when he steps through it.
>
> Before I get specific about what the macro does (since I don't have it
> in front of me), I thought I'd ask the general question about what
> might cause that to happen.
>
> If the macro works when executed manually step-by-step, I would think
> it should work the same way when launched.
>
> Ideas? Comments?

 
Reply With Quote
 
Tim Williams
Guest
Posts: n/a
 
      20th Sep 2007
If there are any "external" operations which run asynchronously with the VBA
then you may get different results depending on how long those operations
take. For example, automating a web page from VBA without waiting for (eg)
pages to complete loading before trying to interact with them will show this
type of difference.

Tim.


"Ken Steinhoff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> My boss built a macro which returns different results when run than
> when he steps through it.
>
> Before I get specific about what the macro does (since I don't have it
> in front of me), I thought I'd ask the general question about what
> might cause that to happen.
>
> If the macro works when executed manually step-by-step, I would think
> it should work the same way when launched.
>
> Ideas? Comments?
>
> --
> Ken Steinhoff
> Telecommunications Manager
> Palm Beach Newspapers, Inc.
> (E-Mail Removed)
> -----------------
> www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
> Access your favorite newsgroups from home or on the road
> -----------------



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error while running macro, but not if stepping through lines. Brian S Microsoft Excel Programming 3 4th Feb 2010 04:23 PM
Different Results running the same macro?? Laurie Microsoft Excel Programming 5 10th Aug 2008 06:33 PM
Macro Stepping George Microsoft Excel Programming 3 23rd Jun 2006 09:29 AM
Single Stepping a Macro Hungry Microsoft Access Form Coding 1 18th Mar 2006 12:42 PM
Stepping through code gives different results than running it! Simon White Microsoft Excel Programming 2 13th Nov 2003 09:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:03 PM.