Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
Looking for assistance in error handling when an advanced filter turns up negative results for deletion.
Here is a snippit of code ...
"No cells were found." Error at red highlighted line.
Jenn
Here is a snippit of code ...
Rich (BB code):
With Worksheets("Data")
If .FilterMode Then .ShowAllData
llastrow = Range("a65536").End(xlUp).Row
With .Range("A1:M" & llastrow)
.AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=Worksheets("Criteria").Range("A1:D2"), _
Unique:=False
Set rngToDelete = .Offset(1).Resize(.Rows.Count - 1, 1).SpecialCells(xlCellTypeVisible)
lredrow = rngToDelete.Count
' MsgBox ("Redundant Rows Found: ") & lredrow
Sheets("Main").Activate
Range("D7").Value = lredrow
End With
"No cells were found." Error at red highlighted line.
Jenn