Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Different results when running macro vs stepping into macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Steinhoff - 20 Sep 2007 14:34 GMT
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?

Signature

Ken Steinhoff
Telecommunications Manager
Palm Beach Newspapers, Inc.
ksteinhoff@pbpost.com
-----------------
www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
Access your favorite newsgroups from home or on the road
-----------------

Marcus Schöneborn - 20 Sep 2007 14:40 GMT
> My boss built a macro which returns different results when run than
> when he steps through it.
[quoted text clipped - 5 lines]
> 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.
Gary Keramidas - 20 Sep 2007 14:42 GMT
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.

Signature

Gary

> My boss built a macro which returns different results when run than
> when he steps through it.
[quoted text clipped - 7 lines]
>
> Ideas? Comments?
JE McGimpsey - 20 Sep 2007 14:45 GMT
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.

> My boss built a macro which returns different results when run than
> when he steps through it.
[quoted text clipped - 7 lines]
>
> Ideas? Comments?
Tim Williams - 20 Sep 2007 17:49 GMT
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.

> My boss built a macro which returns different results when run than
> when he steps through it.
[quoted text clipped - 7 lines]
>
> Ideas? Comments?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.