View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Can Turn Off Internal "Undo" Stack in VBA?

just a not-a-guru idea...........
since you suspect that the stack gets cleared on the first change to a
cell, why don't you try adding some sort of a change to a cell @ the
bottom of your macro?

such as (i know syntax may not be correct):

worksheet.range("xx2") = "327"
worksheet.range("xx2").clearcontents

maybe that would clear the stack so then it can be run again as the
first time?
just an idea.
:)
susan


On Apr 19, 7:22 am, "Larry Adams" wrote:
Per a Google search, I saw where Excel does clear the stack on the first
change to a sheet. I'm wondering, however, if that may be on the first
change to a cell -- and maybe not hide/unhide rows.

So I'm rewriting the code to hide/unhide contiguous rows together in one
statement, rather than one at a time. Will pass out to people at work today
to try and see how it goes. But it is stop gap only.

So the other thought is to throw in an innoculous cell change.

But if this has nothing to do with the undo stack, I still have a problem.
I've included code now under the other reply. Thanks again.

"JE McGimpsey" wrote in message

...



I'm not sure what causes the slowdown in most cases, but I suspect that,
since macros clear XL's Undo stack, it isn't the culprit.


In article ,
"Larry Adams" wrote:


I have an apllication where I examine 5500 rows to see if empty and, if
so,
"Hide" the row. Otherwise, "Unhide". After this macro has been run a
few
times, the macro slows to a crawl.


My hypothesis is that Excel's internal "Undo" feature is tracking these
changes and I am filling up memory set aside for "Undo"s -- which, then
causes Excel to clear the oldest entry in the stack in order to add the
next. At which point it crawls.


I've seen this outside of VBA in Exel proper when I go to do a "Find and
Replace All" on a large data retrieval area. The replace zips along
fine,
then slows, then crawls.


I'm wondering if my VBA "Unhide"/"Hide" code is running into something
similar. Hope I've described the symptoms well enough. Any ideas would
be
welcome. Thanks.- Hide quoted text -


- Show quoted text -