I have the following VBA script, which was simply built to delete the entire row, if a value in Col T is 2. The problem is my dataset is usually large (200k lines +). Is there any way I can speed up this process, or write the script better? The Sheet name is "NonSerial".
Sub DeleteRows()
Dim lr As Long, lr2 As Long
Application.ScreenUpdating = False
lr = Cells(Rows.Count, "T").End(xlUp).Row
Columns("T:T").AutoFilter
ActiveSheet.Range("$T$1:$T$" & lr).AutoFilter Field:=1, Criteria1:="2"
lr2 = Cells(Rows.Count, "T").End(xlUp).Row
If lr2 = 2 Then Exit Sub
Application.DisplayAlerts = False
ActiveSheet.UsedRange.Offset(1, 0).Resize(ActiveSheet.UsedRange.Rows.Count - 1).Rows.Delete
Application.DisplayAlerts = True
Range("T1").AutoFilter
Application.ScreenUpdating = True
End Sub