PC Review


Reply
Thread Tools Rate Thread

Check if filtered cells contain data to delete

 
 
Les Stout
Guest
Posts: n/a
 
      3rd Oct 2006
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 ***
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      3rd Oct 2006
With Worksheets("sheet1")
If .AutoFilter.Range.Columns(1).Cells.SpecialCells(xlCellTypeVisible) _
.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
 
Reply With Quote
 
Les Stout
Guest
Posts: n/a
 
      3rd Oct 2006
Thanks a lot Dave,

I will give it a bash in the morning and let you know..

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Les Stout
Guest
Posts: n/a
 
      4th Oct 2006
Thank you Dave Peterson, your solution worked 100%, thanks.

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling cells with filtered data to another sheet. Brian Ness Microsoft Excel New Users 2 9th Dec 2009 12:23 AM
paste data over hidden cells that are filtered derwood Microsoft Excel Worksheet Functions 1 9th Mar 2008 02:11 AM
Copy visible cells on Filtered data dairell@gmail.com Microsoft Excel Misc 4 18th Jul 2007 08:18 AM
How do I only delete/clear the visible cells in a filtered list? =?Utf-8?B?TWVydg==?= Microsoft Excel Worksheet Functions 5 2nd Mar 2007 07:00 PM
Totals reflecting filtered cells only - not all data in worksheet Mark Microsoft Excel Misc 4 17th Jun 2004 09:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:29 AM.