View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Slow Structure - Row Deletion

See this page for a few ways to do it Kirk
http://www.rondebruin.nl/delete.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Kirk P." wrote in message ...
I've got this code to automate the selection and deletion of any rows that
contain a 0 (zero) in column AA. The code works fine, but rather slowly.
Takes almost 1 minute to delete the zero rows in 1 worksheet, and I want to
apply this code to ALOT of worksheets.

Is there anything that can be done to speed this up?

Dim FirstRow, LastRow, CurRow As Long
Dim col As String

FirstRow = 5
col = "AA"

LastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastC ell).Row
Application.ScreenUpdating = False
For CurRow = LastRow To FirstRow Step -1
If ActiveSheet.Cells(CurRow, col) = 0 Then Rows(CurRow).Delete
Next CurRow

MsgBox "Rows deleted!", vbInformation, "Status"