Many thanks to you both.
My Aswer Is This - I'm pleased you used the "Or" statement in the middle of it, so I could see how you referenced it, also thanks for the clarification on what that line of text meant.
Rick - thanks again.
Both worked beautifully, however Rick's was quicker so I've used that.
Cheers,
Rich
Sub test()
With ActiveSheet
.AutoFilterMode = False
With Range("d1", Range("d" & Rows.Count).End(xlUp))
.AutoFilter 1, "*Record Only*"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub
Sub delme21()
Dim x, lr As Long, lc As Integer
Dim a, b() As Variant, i As Long, e, k As Boolean
Application.ScreenUpdating = False
e = "Record Only"
lr = ActiveSheet.Cells.Find("*", searchorder:=xlByRows, _
searchdirection:=xlPrevious).Row
lc = ActiveSheet.Cells.Find("*", searchorder:=xlByColumns, _
searchdirection:=xlPrevious).Column
a = Cells(1, "D").Resize(lr)
ReDim b(1 To lr, 1 To 1)
For i = 1 To lr
If InStr(a(i, 1), e) > 0 Then
b(i, 1) = 1
k = True
End If
Next i
If k = False Then Exit Sub
Cells(1, lc + 1).Resize(lr) = b
Cells(1, 1).Resize(lr, lc + 1).Sort Cells(1, lc + 1), 1
Cells(1, 1).Resize(Cells(1, lc + 1).End(xlDown).Row, lc + 1).Delete 3
Application.ScreenUpdating = True
End Sub
Also add at the beginning :
Code:Application.Calculation = xlCalculationManual
and at the end :=
Code:Application.Calculation = xlCalculationAutomatic
Currently it runs very slow, up to a couple of hours in fact.
Do you have a huge amount of formulas and formatting on each sheet?
The reason I ask is I just run the code in post #74 on a sheet with columns A to J by 135168 rows having data, where 45056 rows met the criteria to delete and it ran in under 700 milliseconds on every run.
[COLOR=#574123]e = "Record Only"[/COLOR]
[COLOR=#574123]e = ">50[/COLOR][COLOR=#574123]"[/COLOR]
[COLOR=#574123]a = Cells(1, "D")[/COLOR]
[COLOR=#574123]a = Cells(2, "V")[/COLOR]