I'm currently working on a VBA script for deleting rows on an excel spreadsheet with a filter. I've been looking at the following thread and it has give me a good understanding as to how it should work, but I'm struggling to implement it into my own spreadsheet.
Excel VBA Performance - 1 million rows - Delete rows containing a value, in less than 1 min
The Idea of my macro is that it Filters Column 4 by everything that does not contain 'N5' and deletes them.
If anyone could help me write this, it would be greatly appreciated.
--
EDIT: The current formula does work, but it takes approximately 5-7 minutes to run. I need a way to reduce this time as much as possible.
Thank you
Sub LinesideFilter()
Dim t#, crit As Range, data As Range, ws As Worksheet
Dim r&, fc As Range, lc As Range, fr1 As Range, fr2 As Range
FastWB True
t = Timer
Sheets("Data").Activate
Range("A2").Select
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Range("A1:M" & LastRow).Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$M$" & LastRow).AutoFilter Field:=4, Criteria1:="<>n5*" ', Operator:=xlAnd
'Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
ActiveSheet.ShowAllData
FastWB False
End Sub