Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Delete Filtered Rows - without deleting column headings

I have the following code that filters the rows that I
want to delete, however it also deletes the column
headings. How do I change it to preserve the headings?
Thanks in advance for your help.

' Find the rows that do not have a D or a Z in column C
' and delete them. Cells with D are orders rows, cells
' with Z are Sales Doc rows.
Columns("C:C").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<Z*",
Operator:=xlAnd, _
Criteria2:="<D*"
Cells.SpecialCells(xlCellTypeVisible).EntireRow.De lete

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete Filtered Rows - without deleting column headings

Hi Denise

See how Tom use rng2 in this example to copy
http://www.contextures.com/xlautofilter03.html#Copy
You can adapt the code to delete

My new Addin can do this also
http://www.rondebruin.nl/easyfilter.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Denise" wrote in message ...
I have the following code that filters the rows that I
want to delete, however it also deletes the column
headings. How do I change it to preserve the headings?
Thanks in advance for your help.

' Find the rows that do not have a D or a Z in column C
' and delete them. Cells with D are orders rows, cells
' with Z are Sales Doc rows.
Columns("C:C").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<Z*",
Operator:=xlAnd, _
Criteria2:="<D*"
Cells.SpecialCells(xlCellTypeVisible).EntireRow.De lete



Reply
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
Permanently Deleting filtered rows saleem[_2_] Excel Discussion (Misc queries) 3 August 27th 09 09:20 PM
Excel 2007 - Deleting Filtered Rows Marcia Excel Discussion (Misc queries) 2 April 3rd 08 09:26 PM
Deleting filtered rows in Excel RajeevAsthana Excel Discussion (Misc queries) 1 December 6th 07 03:37 PM
Deleting filtered rows in Excel RajeevAsthana Excel Discussion (Misc queries) 1 December 5th 07 03:20 PM
Help!! I have problem deleting 2500 rows of filtered rows!!!! shirley_kee Excel Discussion (Misc queries) 1 January 12th 06 03:24 AM


All times are GMT +1. The time now is 11:00 PM.

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

About Us

"It's about Microsoft Excel"