View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Deleting rows which match filter

Selection.AutoFilter Field:=6, Criteria1:="0"
set rng = Activesheet.Autofilter.Range
set rng = rng.offset(1,0).Resize(rng.rows.count-1)
rng.Delete Shift:=xlup

we need to shift down one row so we don't delete the header row.

--
Regards,
Tom Ogilvy


Fred Smith wrote in message
...
I want to delete all the rows which match a selected filter. Currently I
have:

Selection.AutoFilter Field:=6, Criteria1:="0"
Rows("2:1517").Delete Shift:=xlUp

It works great as long as I don't have more than 1517 rows. How do I

change
it so I specify all data rows in the worksheet (same as an end,down would
do)?

--
Thanks,
Fred
Please reply to newsgroup, not e-mail