L
leungkong
I use the following code to delete some row.
In Excel 2003, it is very fast. (less than 10 second)
But in excel 2007, i save the file type .xlsm, the code is very very
slow...(more than 3 mins)
I find that "Rows(i).Delete" is very slow if I use screenupdate mode.
1 second delete 2 rows only....
How can I speed up this process?
Thanks in advance.
Private Sub DeleteS()
Dim i As Long, LastRow As Long
Dim Counter As Integer
LastRow = Sheets("Data").Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 6 Step -1
If Range("F" & i) = "S" Then
Rows(i).Delete
Counter = Counter + 1
End If
Next i
MsgBox Counter & " row(s) is/are deleted"
End Sub
In Excel 2003, it is very fast. (less than 10 second)
But in excel 2007, i save the file type .xlsm, the code is very very
slow...(more than 3 mins)
I find that "Rows(i).Delete" is very slow if I use screenupdate mode.
1 second delete 2 rows only....
How can I speed up this process?
Thanks in advance.
Private Sub DeleteS()
Dim i As Long, LastRow As Long
Dim Counter As Integer
LastRow = Sheets("Data").Cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 6 Step -1
If Range("F" & i) = "S" Then
Rows(i).Delete
Counter = Counter + 1
End If
Next i
MsgBox Counter & " row(s) is/are deleted"
End Sub