View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Matthew Dyer Matthew Dyer is offline
external usenet poster
 
Posts: 178
Default filter that yeilds no results

On Tuesday, October 2, 2012 6:32:19 PM UTC-7, Matthew Dyer wrote:
I'm trying to delete rows via results from a filter. The problem i'm running into is if there is no criteria that matches the filter then the header row is deleted. here's the Code i'm working with. Converttocol, lastcol and lastrow functions work fine. - Set myrange = Range("A1:" & ConvertToCol(LastCol(ActiveSheet)) & lastrow(ActiveSheet)) myrange.AutoFilter myrange.AutoFilter Field:=12, Criteria1:="=0", _ Operator:=xlOr, Criteria2:="=2E" Range("A2:aq" & (lastrow(ActiveSheet) + 1)).SpecialCells(xlCellTypeVisible).Select Selection.Delete myrange.AutoFilter


That's the simpler way of accomplishing what I was looking for. Thanks for sharing!