Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Different results when running macro vs stepping into macro

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.

-----------------
www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
Access your favorite newsgroups from home or on the road
-----------------
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Different results when running macro vs stepping into macro

»Ken Steinhoff« 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.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Different results when running macro vs stepping into macro

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" wrote in message
...
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.

-----------------
www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
Access your favorite newsgroups from home or on the road
-----------------



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Different results when running macro vs stepping into macro

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 ,
Ken Steinhoff 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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Different results when running macro vs stepping into macro

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" wrote in message
...
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.

-----------------
www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
Access your favorite newsgroups from home or on the road
-----------------



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stepping through gives different result than running Gregg Roberts Excel Programming 10 September 22nd 06 08:42 PM
Sheets("Rpt").Copy different results from running in macro than off excel menu?? tmbo Excel Discussion (Misc queries) 7 August 9th 06 01:13 PM
Macro Stepping George[_31_] Excel Programming 3 June 23rd 06 09:29 AM
Stepping through code gives different results than running it! Simon White Excel Programming 2 November 13th 03 09:44 PM
Macros - stepping left in a macro Rich H. Excel Programming 2 October 5th 03 06:45 PM


All times are GMT +1. The time now is 09:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"