View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Using SpecialCells().EntireRow.Delete on large worksheet - Veryslow!

And one more thing to do--if you've done a print/printpreview, you'll notice
those dotted lines that excel uses to show you where the pages are.

Maybe by hiding those lines, it'll speed excel up--something like:

sheets(My_sheet).DisplayPageBreaks = False

near the top of your code.

Ilan wrote:

Hi all
I have a large worksheet (~60,000 rows) that includes mostly numeric
data and some text rows. I need to delete entire rows that have text
in the cell at column A.
I wrote the following code that selects column A (MyRange) and deletes
the entire row if a text value if found. it works fine, but extremely
slow (~10 min):

Sheets(My_Sheet).Select
MyRange.Select
MyRange.SpecialCells(xlCellTypeConstants,
xlTextValues).EntireRow.Delete

I suspected there is a memory issue working with such a large range at
once, so I tried looping every 100 rows. At first it worked realy
fast, but started to slow again until it finaly took the same amount
of time as before.
If this is a memory issue, is there a way to free the memory inside
the loop? If not, is the a more efficient way to do this?

Thanks,
Ilan


--

Dave Peterson