Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How delete rows with AUTOFILTER (VBA) - more than 1 Criteria 1

Status
Not open for further replies.

bojzon

IS-IT--Management
Sep 18, 2003
25
SI
In a large xls table (excel 2000) I selected data with Autofilter with 3 Criteria at once .:
Field:1, Criteria1:=X
Field:3, Criteria1:=Y
Field:11, Criteria1:=N
Need VBA code to delete (or copy) selected visible rows and reset used range.

Thanks

Bojzon

 
To delete rows when using an autofilter, just delete ALL the rows. Any HIDDEN rows will NOT be deleted

so:
Code:
lRow = activesheet.usedrange.rows.count
Rows("2:" & lRow).entirerow.delete
activesheet.autofiltermode = false
This assumes your data starts in row 2 with headers in row 1

Rgds, Geoff

Three things are certain. Death, taxes and lost data. DPlank is to blame

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top