View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ilan[_2_] Ilan[_2_] is offline
external usenet poster
 
Posts: 4
Default Using SpecialCells().EntireRow.Delete on large worksheet - Very slow!

A follow on the subject:
Following CHORDially's advice, I solved the issue by filtering my data
(using IsNumber True/False) and then copying the selected range to a
new sheet. This way you avoid multiple rows being deleted and jamming
Excel for long minutes.
Here is the sub I used:
---------------------------------------------------
Sub MoveNumRows()
' Moves only rows with number in sheet3-column A to sheet4
Dim My_Range As Range
Dim Last_Row As Double
Dim Rng As String

Application.ScreenUpdating = False
Last_Row = Find_Last_Row(Sheet3, 3, 1) 'Find the last row in
sheet3
Range("aa3").Formula = "=ISNUMBER(A3)"
Rng = "aa3"
Set My_Range = Range(Rng)
My_Range.Select
Selection.AutoFill Destination:=Range("aa3:aa" & Last_Row),
Type:=xlFillDefault
Range("aa3").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="TRUE"
Range("A2:y2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet4").Select
Range("A1").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub
---------------------------------------------------
Thanks all,
Ilan

(Ilan) wrote in message . com...
Thank you all for your help.
I added the "Application.Calculation = xlCalculationManual " Tom
suggested and looping from the bottom-up and it did improve, though
not a lot.
However, when I run the macro a second time, it starts very slow right
from the begining. So I have to close the file and re-open it.

I'm no expert in Excel, but it looks as if the application reserves a
lot of resources for the file and frees them only after the file is
closed, something like the Clipboard or Undo. If this makes any sense,
is there a way to disable them?

Ilan