View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Kevryl Kevryl is offline
external usenet poster
 
Posts: 89
Default running a Macro in 2007 which was created in 2003

Jon, thanks I'll try that next time I have a stall. :-) DoEvents.... right
got it.

"Jon Peltier" wrote:

If the code fails when run at full speed but works when stepped through,
all else being equal, it usually means Excel has some housekeeping to
do, that it hasn't finished before the command.

Inserting a one-word line

DoEvents

before the line that shows the error will often give Excel a chance to
do all that background stuff. Excel 2007 is more prone to this issue
than 2003.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 4/22/2010 5:25 AM, Kevryl wrote:
Hi Simon, you've got me, being new to 2007 too. No doubt someone will soon
give you a definitive answer soon, but until then...

I had a problem running a macro that tripped on the line,
"Windows("Accounting.xls").Activate" which was merely to switch between 2
windows in the one instance of Excel. It tripped the first time giving an
error message, so I went into debugging, stepping over all the commands up to
that one and then "stepped into" from there. It found its way through without
an issue and then worked perfectly after that. So its possible that if you do
the same, yours too may "settle in" (OK, some Excel geek can ridicule the
terminology, but it worked ;-). )

Remember that any commands before the one that tripped will have been
executed, so you may not want them to execute again! Turn on the "debug"
toolbar and use the "step over" and "step into" buttons. Be aware that the
"Continue" button (right-pointing triangle) will run from the point you're at
right to the end.

"Simon" wrote:

Hi there, I hope you can help, I am not VB literate unfortunately but I am
trying to run a macro with the following line of code which creates an error:

LastRow = Master_Wksht.Range("N"& Rows.Count).End(xlup).Row

Is there a change between versions which means this line won't work any more?



.