LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Delete rows with different criteria

That didn't quite work. I don't think I can delete the "Used range" because
I have stuff in rows 1 through 10 that I want to keep. Does that make sense?

I think it may also be hiding all the fields and not filtering them
correctly. I use 700 rows and on two of the sheets 700 rows are hidden...
none are deleted.


"ben" wrote:

change your criteria to show ONLY THE LINES YOU PREVIOUSLY HAD HIDDEN and
then delete all rows


Selection.AutoFilter Field:=8, Criteria1:="<", Operator:=xlAnd
Selection.AutoFilter Field:=14, Criteria1:="=0", Operator:=xlAnd
Selection.AutoFilter Field:=18, Criteria1:="<7.00", Operator:=xlAnd
activesheet.usedrange.delete
Sheets("AG Non Call").Select
Selection.AutoFilter Field:=8, Criteria1:="<#N/A N Ap", Operator:=xlAnd
Selection.AutoFilter Field:=14, Criteria1:="<0", Operator:=xlAnd
Selection.AutoFilter Field:=18, Criteria1:="<7.00", Operator:=xlAnd
Sheets("CORPS").Select
Selection.AutoFilter Field:=14, Criteria1:="<0", Operator:=xlAnd
Selection.AutoFilter Field:=18, Criteria1:="<8.00"
activesheet.usedrange.delete

test this code before finalizing and saving
--
When you lose your mind, you free your life.


"John" wrote:

I have a simple macro that filters (hides) the data that is unapplicable in
each worksheet. How would I make the macro delete the rows that it is hiding
in the autofilter? My code is below.

THANKS!

Selection.AutoFilter Field:=8, Criteria1:="<", Operator:=xlAnd
Selection.AutoFilter Field:=14, Criteria1:="0", Operator:=xlAnd
Selection.AutoFilter Field:=18, Criteria1:="=7.00", Operator:=xlAnd
Sheets("AG Non Call").Select
Selection.AutoFilter Field:=8, Criteria1:="=#N/A N Ap", Operator:=xlAnd
Selection.AutoFilter Field:=14, Criteria1:="0", Operator:=xlAnd
Selection.AutoFilter Field:=18, Criteria1:="=7.00", Operator:=xlAnd
Sheets("CORPS").Select
Selection.AutoFilter Field:=14, Criteria1:="0", Operator:=xlAnd
Selection.AutoFilter Field:=18, Criteria1:="=8.00"

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete all rows if criteria not matched ongcong Excel Discussion (Misc queries) 4 August 25th 08 07:58 PM
Delete rows based on certain criteria Coal Miner Excel Discussion (Misc queries) 2 March 3rd 06 05:56 PM
Delete rows where cells contain various criteria gmunro Excel Programming 1 March 10th 05 02:27 PM
delete rows with criteria S.E. Excel Programming 5 September 9th 04 04:04 PM
Delete rows w/o criteria RickK[_2_] Excel Programming 2 October 31st 03 04:48 PM


All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"