View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Deleting Rows on condition & Long processing time

Perhaps...

Sub DeleteRows2()
Dim lLastRow&, n&, lCalcMode&
Dim wks As Worksheet

Const sCheck$ = "F1PPM60601" '//edit to suit
Const lNoCalc = -4135
Const lStartRow& = 9 '//edit to suit
Set wks = ActiveWorkbook.Sheets("PM4") '//edit to suit

With Application
lCalcMode = .Calculation: .Calculation = lNoCalc
.ScreenUpdating = False
End With

On Error GoTo ErrExit
With wks
lLastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
For n = lLastRow To lStartRow Step -1
If sCheck < .Cells(n, 1).Value Then .Rows(n).Delete
Next 'n
End With

ErrExit:
With Application
.Calculation = lCalcMode: .ScreenUpdating = True
End With
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion