I have several really large excel data files and I need to go through them all and delete all rows where the value of the cell in column T is 1. Right now my code looks like:
Sub test()
Dim cell As Range
For Each cell In Worksheets("Sheet1").Range("T5", "T900000")
If cell.Value = 1 Then
cell.EntireRow.Delete
End If
Next cell
End Sub
It seems to be working, but takes forever to run and I'm going to have to do this a bunch of times. Is there a better way of doing this, or some way to optimize what I already have to make it run faster?
See Question&Answers more detail:os