View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bill Manville Bill Manville is offline
external usenet poster
 
Posts: 473
Default Filter and Delete Picture

Wiwi wrote:
With WS_OrderSummary
Selection.AutoFilter Field:=2, Criteria1:=Style
Selection.AutoFilter Field:=5, Criteria1:=Buyer
Selection.AutoFilter Field:=6, Criteria1:=Agent
ActiveCell.EntireRow.Delete


'Firstly, Selection may not be on WS_OrderSummary or in the table you
want to filter. so

With WS_OrderSummary.Range("A1").CurrentRegion
.AutoFilter ' remove any previous filter
.AutoFilter Field:=2, Criteria1:=Style
.AutoFilter Field:=5, Criteria1:=Buyer
.AutoFilter Field:=6, Criteria1:=Agent

'Secondly, to determine whether the filter found any rows, and to
delete such rows:
If .Columns(1).SpecialCells(xlVisible).Count1 Then
' not just header row visible - delete visible data row(s)
.Offset(1).Resize(.Rows.Count-1).SpecialCells(xlVisible). _
EntireRow.Delete
End If
End With

Hope this helps

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup