On 3 Aug., Rruffpaw wrote:
> I have a very large Excel spreadsheet (13 MB) with several macros. One
> of them runs a loop with multiple commands.
>
> The macro runs fine, as long as I sit back and just watch it run. If I
> click on another window however, it invariably freezes and I have to
> terminate Excel.
>
> Any ideas on how I can remedy this?
>
> I'm running Excel 2003 on Windows XP, but have noticed the same
> problem with the same spreadsheet on a machine running Excel 2007,
> also on Windows XP.

Most probably this is caused by improper programming: Many macros
(especially those that have been recorded with the macro recorder)
will only work properly if the user does not interfere with its
execution. The reason for this is that many macros do not refer to
some selection directly but use two steps: first activate the desired
cells, then work on the current selection. This is fine as long as no
one messes around with the current selection (IOW, you ;-) A macro
that is programmed properly will of course never use this technique
(the macro recorder can not do it any other way than the current
selection, that's just the way it is designed), so that the user would
be free to go through the workbook without messing up the macro
execution (note that the code would also have to call DoEvents from
time to time or else the UI stays frozen).

If you want to find out what has happened when Excel appears to have
frozen, simply press Escape (you may have to hold it for 2 or 3
seconds). This will pause the execution of the macro so that you can
see what it is doing in the debugger.

Regards,
Stuart

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to