View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Check if filtered cells contain data to delete

With Worksheets("sheet1")
If .AutoFilter.Range.Columns(1).Cells.SpecialCells(xl CellTypeVisible) _
.Count = 1 Then
'Only headers
MsgBox "nothing to delete"
Else
With .AutoFilter.Range
.Resize(.Rows.Count - 1).Offset(1, 0).EntireRow.Delete
End With
End If
End With


Les Stout wrote:

Hi all, I need a bit of help with code for the following. I am filtering
a column for certain criteria and i need to check if the other cells in
the filtered visual cells contain data, if no data continue with code
else delete rows visable only.

Selection.AutoFilter Field:=9, Criteria1:="=*za-t-m-**", Operator:=xlAnd

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson