This code was in another topic, and I tried utilizing it to look i
Column U for anything that's not D6 and delete that row. Here's what
got but the debug keeps pointing to the ActiveSheet.ShowAllData part o
the code. What am I doing wrong in this code?
Dim rng As Range, rng1 As Range
Range("U1").CurrentRegion.AutoFilter _
Field:=3, Criteria1:="<D6", Operator:=xlAnd
Set rng = Intersect(ActiveSheet.AutoFilter.Range, Columns(3))
Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1, 1)
On Error Resume Next
Set rng1 = rng.SpecialCells(xlVisible)
On Error GoTo 0
If Not rng1 Is Nothing Then
rng1.EntireRow.Delete
End If
ActiveSheet.ShowAllData
Range("U1").CurrentRegion.AutoFilter
Sub DeleteRows()
Dim rng As Range, rng1 As Range
Range("C1").CurrentRegion.AutoFilter _
Field:=3, Criteria1:="<26", Operator:=xlAnd
Set rng = Intersect(ActiveSheet.AutoFilter.Range, Columns(3))
Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1, 1)
On Error Resume Next
Set rng1 = rng.SpecialCells(xlVisible)
On Error GoTo 0
If Not rng1 Is Nothing Then
rng1.EntireRow.Delete
End If
ActiveSheet.ShowAllData
Range("C1").CurrentRegion.AutoFilter
End Sub
--
DK
-----------------------------------------------------------------------
DKY's Profile:
http://www.excelforum.com/member.php...fo&userid=1451
View this thread:
http://www.excelforum.com/showthread.php?threadid=26735