View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Speeding up a part of a procedure

If you've done a file|print or a file|print preview, you'll see page break
indicator lines on the worksheet.

If you're deleting rows, excel wants to determine where these lines should
be--and that slows things down.

And being in view|page break preview will cause the same problem.

Try putting a couple of lines like these at the top of your routine:

ActiveSheet.DisplayPageBreaks = False
ActiveWindow.View = xlNormalView


You may want to turn calculation to manual at the start and change it back when
your code is done.


" wrote:

Hi !

Within a procedure, I have written this instructions for deleting :

With Sheet01
'Delete same items
For i = iLast To 1 Step -1
If .Range("d51").Offset(i, 0).Value =
.Range("d51").Offset(i - 1).Value Then
.Range("d51").Offset(i, 0).Delete shift:=xlUp
End If
Application.StatusBar = iLast - i & "/" & iLast
Next
End With

On my PC (IBM ThinkPad - Pentium M - Windows 2000 and Excel
9.0.76-SP3), it works without problem : within a couple of seconds, the
deleting is done.
For a reason I do not understand, it does not work on the PC of my
colleagues (Compacq nc6000 - Pentium M - Windows XP - Excel
10.6789.6626 SP3) : the procedure starts well but on a slower way, than
the speed gradually decreases (I have written a counter in the
statusbar to see this decrease of the speed). with small list it
doesn't really matter but with bigger one (currently the iLast value is
about 2000), it stops Excel ! The sole way to continue is to end the
task in the Windows Task Manager ! And the user has lost the work done
by the macro...

Maybe someone has an idea for replacing this procedure by another one
...
Thanks in advance.
Herve


--

Dave Peterson